Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result of boolean expression can not be concatenated with string literal [CORE5408] #5681

Closed
firebird-automations opened this issue Nov 28, 2016 · 4 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

SQL> select true || 'aaa' from rdb$database;

CONCATENATION

TRUEaaa

(OK, expected)

SQL> select (true = true)|| 'aaa' from rdb$database;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 21
-||

SQL> select (true is true)|| 'aaa' from rdb$database;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 22
-||

SQL> select 'aaa' || true from rdb$database;

CONCATENATION

aaaTRUE

(OK, expected; note that here order of boolean and string is changed comparing with sample #⁠1)

SQL> select 'aaa' || (true = true) from rdb$database;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 23
-=

SQL> select 'aaa' || (true is true) from rdb$database;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 23
-is

Commits: 5f6d20c 64fa7dc

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

From the perspective of the SQL standard, concatenation of types other than a string type would require an explicit cast, because the concatenation operator is only defined between strings (and between arrays).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment