Skip to content

Conversation

@r1b
Copy link

@r1b r1b commented Nov 8, 2025

Using the DEFAULT variant of the CREATE FUNCTION default argument syntax causes a parse error with unnamed arguments. The proposed fix skips the logic to disambiguate argname argtype from argtype when the DEFAULT keyword is detected. IIUC, this is safe because argname and argtype can only take on the name DEFAULT when quoted.

e.g, in postgres this is allowed:

CREATE DOMAIN "DEFAULT" AS int;
CREATE FUNCTION add(INTEGER, "DEFAULT" "DEFAULT" DEFAULT 1) RETURNS INTEGER LANGUAGE SQL AS 'select $1 + $2;';

But "DEFAULT" (the argname) and "DEFAULT" (the argtype) cannot appear unquoted

Ref: apache/datafusion#18450 (comment)

@r1b
Copy link
Author

r1b commented Nov 8, 2025

Please let me know if there is a better place for a more general fix. It seems like adding DEFAULT to RESERVED_FOR_IDENTIFIER might do the trick be necessary as well, but not sure if this is appropriate in all supported dialects.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant