|
5 | 5 | ISSUE: 5450 |
6 | 6 | TITLE: Allow implicit conversion between boolean and string |
7 | 7 | DESCRIPTION: |
8 | | - Test contains of TWO set of expressions: those which should finish OK and which should FAIL. |
9 | | - Expressions that should work fine are called directly with checking only their result. |
10 | | - Expressions that should fail are inserted into table and are called via ES from cursor on that table. |
11 | | - Inside this cursor we register values of gdscode and sqlstate that raise, and issue via output args |
12 | | - three columns: statement, gdscode, sqlstate. This output is then checked for matching with expected. |
| 8 | + Test contains TWO set of expressions: those which should finish OK and which should FAIL. |
| 9 | + Expressions that should work fine are called directly with checking only their result. |
| 10 | + Expressions that should fail are inserted into table and are called via ES from cursor on that table. |
| 11 | + Inside this cursor we register values of gdscode and sqlstate that raise, and issue via output args |
| 12 | + three columns: statement, gdscode, sqlstate. This output is then checked for matching with expected. |
13 | 13 | JIRA: CORE-5167 |
14 | 14 | FBTEST: bugs.core_5167 |
| 15 | +NOTES: |
| 16 | + [06.09.2023] pzotov |
| 17 | + Expression "true in ('unknown', 'false', 'true')" failed in FB 3.x/4.x because first literal ('unknown') |
| 18 | + could not be conversed properly. This was expected: old algorithm of IN(<list>) compared literals using "OR" basis, |
| 19 | + from left to right, one by one. |
| 20 | + But this is not so in FB 5.x+ since changed algorithm of IN(<list>), and this expression is evaluated |
| 21 | + successfully. Because of that, it was decided to replace this expr. with: |
| 22 | + "select 'unknown' in (true) as result from rdb$database" (it fails on any major FB version). |
| 23 | + See also: |
| 24 | + 1) https://github.com/FirebirdSQL/firebird/commit/0493422c9f729e27be0112ab60f77e753fabcb5b |
| 25 | + ("Better processing and optimization if IN <list> predicates (#7707)") |
| 26 | + 2) letter from dimitr, 05-sep-2023 20:51 |
15 | 27 | """ |
16 | 28 |
|
17 | 29 | import pytest |
|
112 | 124 |
|
113 | 125 | -- convers error: |
114 | 126 | insert into test(id, expr) values(gen_id(g,1), 'select true = ''unknown'' as result from rdb$database'); -- convers error |
115 | | - insert into test(id, expr) values(gen_id(g,1), 'select true in (''unknown'', ''false'', ''true'') as result from rdb$database'); -- convers error |
| 127 | + insert into test(id, expr) values(gen_id(g,1), 'select ''unknown'' in (true) as result from rdb$database'); -- convers error |
116 | 128 | insert into test(id, expr) values(gen_id(g,1), 'select cast(''true'' as blob) > false as result from rdb$database'); |
117 | 129 | insert into test(id, expr) values(gen_id(g,1), 'select list(b, '''') > false as result from (select ''true'' as b from rdb$database)'); |
118 | 130 | commit; |
|
341 | 353 | RAISED_SQL 22018 |
342 | 354 |
|
343 | 355 | EXPR_NO 38 |
344 | | - RUN_EXPR select true in ('unknown', 'false', 'true') as result from rdb$database |
| 356 | + RUN_EXPR select 'unknown' in (true) as result from rdb$database |
345 | 357 | RAISED_GDS 335544334 |
346 | 358 | RAISED_SQL 22018 |
347 | 359 |
|
|
0 commit comments