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

Remove support for array function and only support array[] style postgres syntax #3115

Closed
alamb opened this issue Aug 12, 2022 · 1 comment
Closed
Labels
enhancement New feature or request

Comments

@alamb
Copy link
Contributor

alamb commented Aug 12, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
In apache/datafusion-sqlparser-rs#566, @MazterQyou is adding some more sophisticated support for array parsing in SQL and it turns out that postgres treats the the array keyword specially so it can't be a function

Datafusion already has support for the equivalent array creation using the postgres syntax array[] (note the brackets):

select array[1,2];
+-------------+
| List([1,2]) |
+-------------+
| [1, 2]      |
+-------------+
1 row in set. Query took 0.053 seconds.
❯ select array(1,2);
+--------------------------+
| array(Int64(1),Int64(2)) |
+--------------------------+
| [1, 2]                   |
+--------------------------+
1 row in set. Query took 0.016 seconds.

Describe the solution you'd like
I propose removing support for select array(1,2) syntax to conform with posgres:

alamb=# select array[1,2];
 array 
-------
 {1,2}
(1 row)

alamb=# select array(1,2);
ERROR:  syntax error at or near "1"
LINE 1: select array(1,2);
                     ^

Describe alternatives you've considered
Do something special with parser

Additional context

This change will likely be required when we update to the next change of sqlparser: apache/datafusion-sqlparser-rs#566

@alamb
Copy link
Contributor Author

alamb commented Aug 19, 2022

Closed by #3199

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant