tconbeer / sqlfmt

sqlfmt formats your dbt SQL files so you don't have to
https://sqlfmt.com
Apache License 2.0
364 stars 15 forks source link

PostgreSQL formatting of extensions is broken #591

Closed oleorhagen closed 2 months ago

oleorhagen commented 2 months ago

Describe the bug A clear and concise description of what the bug is.

Using the single line example:

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

Run sqlfmt on it, and get:

CREATE EXTENSION IF NOT EXISTS uuid-ossp;

Run sqlfmt again, and it now errors.

To Reproduce

More succintly:

cat 001_init.sql
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
cat 001_init.sql | sqlfmt 
CREATE EXTENSION IF NOT EXISTS uuid-ossp;
cat 001_init.sql | sqlfmt | sqlfmt
at or near "-": syntax error

Expected behavior

I expect the formatting to be idempotent, and not format it to something which the tool itself thinks is invalid.

Actual behavior See above.

Additional context

sqlfmt --version
sqlfmt 0.5.0

Tool is installed as an arch-linux package.

tconbeer commented 2 months ago

You're using the wrong package. You install this one with

pip install shandy-sqlfmt

oleorhagen commented 1 month ago

You're using the wrong package. You install this one with

pip install shandy-sqlfmt

Oh my, I apologize. Old outdated arch linux package tripped me up. :pray: