sbdchd / squawk

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

Parse error on refreshing collation version #323

Closed JennToo closed 10 months ago

JennToo commented 10 months ago

The migration:

-- \connect pipelines
REINDEX DATABASE pipelines;
ALTER DATABASE pipelines REFRESH COLLATION VERSION;

From squawk:

migrations/staged/reindex.sql:0:0: error: invalid-statement

   0 | -- \connect pipelines
   1 | REINDEX DATABASE pipelines;
   2 | ALTER DATABASE pipelines REFRESH COLLATION VERSION;

  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 `AlterDatabaseRefreshCollStmt`, expected one of `T
ransactionStmt`, `SelectStmt`, `IndexStmt`, `AlterTableStmt`, `RenameStmt`, `CreateStmt`, `InsertStmt`, `UpdateStmt`, `DeleteStmt`, `CreateSchemaStmt`, `AlterDomainStmt`, `GrantStmt`, `GrantRoleStmt`, `AlterDefaultPrivilegesStmt`, `C
opyStmt`, `VariableSetStmt`, `VariableShowStmt`, `CreateTableSpaceStmt`, `DropTableSpaceStmt`, `CreateExtensionStmt`, `AlterExtensionStmt`, `DropStmt`, `AlterObjectSchemaStmt`, `AlterExtensionContentsStmt`, `CreateFdwStmt`, `AlterFdw
Stmt`, `CreateForeignServerStmt`, `AlterForeignServerStmt`, `CreateForeignTableStmt`, `CreateUserMappingStmt`, `AlterUserMappingStmt`, `DropUserMappingStmt`, `ImportForeignSchemaStmt`, `CreatePolicyStmt`, `AlterPolicyStmt`, `CreateAm
Stmt`, `CreateTrigStmt`, `CreateEventTrigStmt`, `AlterEventTrigStmt`, `CreateFunctionStmt`, `CallStmt`, `AlterFunctionStmt`, `CreatePLangStmt`, `CreateRoleStmt`, `AlterRoleStmt`, `AlterRoleSetStmt`, `DropRoleStmt`, `CreateSeqStmt`, `
AlterSeqStmt`, `DefineStmt`, `CreateDomainStmt`, `CreateOpClassStmt`, `CreateOpFamilyStmt`, `AlterOpFamilyStmt`, `TruncateStmt`, `CommentStmt`, `SecLabelStmt`, `DeclareCursorStmt`, `ClosePortalStmt`, `FetchStmt`, `CreateStatsStmt`, `
ExplainStmt`, `AlterOwnerStmt`, `DoStmt`, `AlterObjectDependsStmt`, `AlterOperatorStmt`, `RuleStmt`, `NotifyStmt`, `ListenStmt`, `UnlistenStmt`, `CompositeTypeStmt`, `CreateEnumStmt`, `CreateRangeStmt`, `AlterEnumStmt`, `ViewStmt`, `
LoadStmt`, `CreatedbStmt`, `AlterDatabaseStmt`, `AlterDatabaseSetStmt`, `DropdbStmt`, `AlterSystemStmt`, `ClusterStmt`, `VacuumStmt`, `CreateTableAsStmt`, `RefreshMatViewStmt`, `CheckPointStmt`, `DiscardStmt`, `LockStmt`, `Constraint
sSetStmt`, `ReindexStmt`, `CreateConversionStmt`, `CreateCastStmt`, `CreateTransformStmt`, `PrepareStmt`, `ExecuteStmt`, `DeallocateStmt`, `DropOwnedStmt`, `ReassignOwnedStmt`, `AlterTSDictionaryStmt`, `AlterTSConfigurationStmt`, `Cr
eatePublicationStmt`, `AlterPublicationStmt`, `CreateSubscriptionStmt`, `AlterSubscriptionStmt`, `DropSubscriptionStmt` at line 1 column 159
  help: Modify your Postgres statement to use valid syntax.

I'm doing this migration to resolve a warning from postgres, with the solution mentioned here: https://dba.stackexchange.com/questions/324649/collation-version-mismatch

Not a huge problem of course, I can just disable the linter for this one. But thought I'd report it anyways. Thanks for the great project btw! It's been very handy for a database newb like me 💖

chdsbd commented 10 months ago

Thanks for the report! This is fixed now in 0.24.2

JennToo commented 10 months ago

Awesome, thanks a bunch!