Open hughcameron opened 2 months ago
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Thanks for the PR. A few quick questions and thoughts:
id
, name
, location
, type
detected as keywords and converted to uppercase when using keywordCase: "upper"
.INT
, CHAR
, ARRAY
.I'm pretty busy this week... not sure how much time I have to properly review this.
For bonus points, you can update the wiki with information about DuckDB. That will also make it easier for me to review this. Otherwise I'll have to go and figure out all of this about DuckDB by myself.
I was about to submit a PR also, I will make some comment in your code.
Thanks for the comments above. The errors from the test suite are now down to five:
DuckDBFormatter
✕ supports ARRAY[] literals (2 ms)
✕ dataTypeCase option does NOT affect ARRAY[] literal case
✕ keywordCase option affects ARRAY[] literal case
✕ dataTypeCase option affects ARRAY type case (2 ms)
✕ supports array slice operator
@nene - I'll look into filling out the wiki 👍
To fix ARRAY[]
tests:
ARRAY
to dataTypes
and remove it from keywords and functions lists.To fix the bar[1:]
test:
BAR
from list of functionsI would guess the builtin BAR()
function is rarely used. Well... at least I failed to find documentation of it, because it's super hard to google as Postgres docs contain loads of foo
and bar
in example code. I think it's better for the formatter to also support the more common use case of bar
as a name used in example code.
PS. Make sure to run yarn pretty
. (Looks like that currently also changes the .pre-commit-hooks.yaml
file... you can let Prettier to reformat that, or leave it as-is. Either way is fine.)
The test suite is passing completely now 🎉
I'll collate some notes for the wiki over the next week. Are there any other steps needed before merging?
Thanks. I don't think there's anything else.
This pull request adds support for the DuckDB SQL dialect to the SQL Formatter library.
Description:
Benefits:
Testing:
Please review the changes and provide feedback.