-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix concat(null) is null return false, it should be true(issue: #20306)
#20320
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
Conversation
|
Postgres also returns false for this, needs careful consideration. |
|
@hannes I got it! Postgres returns '' when executing |
|
Yes, that makes sense |
I noticed that |
|
PostgreSQL: postgres=# SELECT concat(NULL::VARCHAR) IS NULL r;
r
---
f
(1 row)
postgres=# SELECT concat(NULL::VARCHAR, NULL::VARCHAR) IS NULL r;
r
---
f
(1 row)
postgres=# SELECT NULL::VARCHAR || NULL::VARCHAR IS NULL r;
r
---
t
(1 row)
postgres=# SELECT array_cat(NULL::INT[]) IS NULL r;
ERROR: function array_cat(integer[]) does not exist
LINE 1: SELECT array_cat(NULL::INT[]) IS NULL r;
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
postgres=# SELECT array_cat(NULL::INT[], NULL::INT[]) IS NULL r;
r
---
t
(1 row)
postgres=# SELECT NULL::INT[] || NULL::INT[] IS NULL r;
r
---
t
(1 row)DuckDB v1.4.3: D SELECT concat(NULL::VARCHAR) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
D SELECT concat(NULL::VARCHAR, NULL::VARCHAR) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
D SELECT NULL::VARCHAR || NULL::VARCHAR IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ true │
└─────────┘
D SELECT array_cat(NULL::INT[]) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
D SELECT array_cat(NULL::INT[], NULL::INT[]) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
D SELECT NULL::INT[] || NULL::INT[] IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ true │
└─────────┘DuckDB memory D SELECT concat(NULL::VARCHAR) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
memory D SELECT concat(NULL::VARCHAR, NULL::VARCHAR) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
memory D SELECT NULL::VARCHAR || NULL::VARCHAR IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ true │
└─────────┘
memory D SELECT array_cat(NULL::INT[]) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
memory D SELECT array_cat(NULL::INT[], NULL::INT[]) IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ false │
└─────────┘
memory D SELECT NULL::INT[] || NULL::INT[] IS NULL r;
┌─────────┐
│ r │
│ boolean │
├─────────┤
│ true │
└─────────┘EDIT: in PostgreSQL the |
the title of this PR is no longer appropriate. the results of executing SELECT concat(NULL::VARCHAR) are different in main and V1.4; In V1.4 and PostgreSQL, it returns ''; in |
lnkuiper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
this pr fix: #20306