sbdchd / squawk

🐘 linter for PostgreSQL, focused on migrations
https://squawkhq.com
GNU General Public License v3.0
541 stars 37 forks source link

Can't parse PSQL respose when updating autovacuum settings in alembic migration #320

Closed luisgc93 closed 8 months ago

luisgc93 commented 8 months ago

First of all, thanks for building this great tool, really appreciate it.

I have an alembic migration that does not seem to be supported by squawk. My team decided to create a migration for these autovacuum setting changes in order to keep track of them in version control:

Upgrade:

ALTER TABLE table_name SET (autovacuum_vacuum_scale_factor = 0.0);
ALTER TABLE table_name SET (autovacuum_vacuum_threshold = 100000);

Downgrade:

ALTER TABLE table_name SET (autovacuum_vacuum_scale_factor = 0.2);
ALTER TABLE table_name SET (autovacuum_vacuum_threshold = 50);

When I run the command alembic upgrade head --sql | squawk I get the following error:

note: Squawk schema failed to parse Postgres response. This indicates a bug with Squawk. 
Please report this error to https://github.com/sbdchd/squawk. Schema error: unknown variant
`List`, expected one of `TypeCast`, `FuncCall`, `Constraint`, `ColumnDef`, `A_Const`,
`ReplicaIdentityStmt`, `SQLValueFunction`, `PartitionCmd` at line 1 column 509925

help: Modify your Postgres statement to use valid syntax.

find detailed examples and solutions for each rule at https://squawkhq.com/docs/rules

If I remove just that particular migration, the command works as expected.

chdsbd commented 8 months ago

@luisgc93 Thanks for the report! squawk-cli@0.24.1 has been released with a fix.