SQLite Forum

Operator behavior change
Login

Operator behavior change

(1) By anonymous on 2020-08-03 20:33:46 [link] [source]

Hello:

When running:
SELECT '1.txt' + 1;

The result in 3.22.0:
2

The result in 3.31.1:
2.0

The same difference for (-). Is this intended? Thanks.

Best regards,
Martin

(2) By Gunter Hick (gunter_hick) on 2020-08-04 05:49:05 in reply to 1 [link] [source]

try

select cast('1.txt' as numeric);

my guess: SQLite is now reading '1.' as the numeric part of the text constant, which is a float, where it previously read only '1' as an integer.

Also try explain select '1.txt' + 1;

2     String8        0     2     0     1.txt          00  NULL
3     Integer        1     3     0                    00  NULL
4     Add            3     2     1                    00  NULL

Ist there an affinity opcode before the add in 3.31.1?

(3) By Dan Kennedy (dan) on 2020-08-04 13:40:12 in reply to 1 [source]

Intentional I think. It changed here (see the linked tickets):

https://sqlite.org/src/info/67a68af5578f08d2

first release with the new behaviour is 3.29.0

(4) By anonymous on 2020-08-04 14:06:05 in reply to 3 [link] [source]

Thanks for looking into that. Good to be sure.

Martin