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

ifnull returns an error when chained (nullif works) #11907

Open
2 tasks done
gotdan opened this issue May 2, 2024 · 2 comments
Open
2 tasks done

ifnull returns an error when chained (nullif works) #11907

gotdan opened this issue May 2, 2024 · 2 comments

Comments

@gotdan
Copy link

gotdan commented May 2, 2024

What happens?

Function chaining works correctly for the nullif function, but returns an error for the ifnull function.

To Reproduce

nullif:
SELECT ['abc'].nullif(['def']) correctly returns ['abc']

ifnull without chaining:
SELECT ifnull(['abc'], ['def']) correctly returns ['abc'].

ifnull with function chaining:
SELECT ['abc'].ifnull(['def']) returns an error of "Parser Error: Wrong number of arguments to IFNULL."

OS:

Mac M1

DuckDB Version:

0.10.1

DuckDB Client:

Python

Full Name:

Dan Gottlieb

Affiliation:

Central Square Solutions

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@gotdan gotdan changed the title ifnull is not chainable ifnull returns an error when chained May 2, 2024
@gotdan gotdan changed the title ifnull returns an error when chained ifnull returns an error when chained (nullif works) May 2, 2024
@sreeharshar84
Copy link
Contributor

I'm not sure this is a bug. I see the following on Mysql:

SELECT ['abc'].ifnull(['def'])

ERROR 1064 (42000) at line 17: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '['abc'].ifnull(['def'])' at line 1

Postgres is also similar:

psql:commands.sql:30: ERROR: syntax error at or near "["
LINE 1: SELECT ['abc'].ifnull(['def'])

@Tishj
Copy link
Contributor

Tishj commented May 21, 2024

https://duckdb.org/docs/sql/functions/overview.html#function-chaining-via-the-dot-operator
It's not a standard sql feature

We can and want to fix it, but it will not make 1.0

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

No branches or pull requests

3 participants