Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add reserved keyword check in pg (#15192)
Vincent Huanga2fa14e3a228
diff --git a/backend/plugin/parser/pg/completion.go b/backend/plugin/parser/pg/completion.goindex ace6e7a23c..06fe1d1ce2 100644--- a/backend/plugin/parser/pg/completion.go+++ b/backend/plugin/parser/pg/completion.go@@ -1329,7 +1329,8 @@ func (c *Completer) quotedIdentifierIfNeeded(s string) string {if strings.ToLower(s) != s {return fmt.Sprintf(`"%s"`, s)}-- // TODO(rebelice): check reserved keywords here.+ if c.lexer.IsReservedKeyword(strings.ToUpper(s)) {+ return fmt.Sprintf(`"%s"`, s)+ }return s}diff --git a/go.mod b/go.modindex 7c6c333409..e4351e409e 100644--- a/go.mod+++ b/go.mod@@ -27,7 +27,7 @@ require (github.com/bytebase/google-sql-parser v0.0.0-20250116032737-689a327f9465github.com/bytebase/mysql-parser v0.0.0-20241224071214-cb9fd84811ddgithub.com/bytebase/plsql-parser v0.0.0-20241217100236-775726d725f9- github.com/bytebase/postgresql-parser v0.0.0-20250211003522-336459624c54+ github.com/bytebase/postgresql-parser v0.0.0-20250213053010-aeb8220eb3bbgithub.com/bytebase/snowsql-parser v0.0.0-20250124075214-562d62e69c35github.com/bytebase/tidb-parser v0.0.0-20240821091609-162fffe2a839github.com/cenkalti/backoff/v4 v4.3.0diff --git a/go.sum b/go.sumindex 27343f6436..d8bcda6bfe 100644--- a/go.sum+++ b/go.sum@@ -845,8 +845,8 @@ github.com/bytebase/pkcs8 v0.0.0-20240612095628-fcd0a7484c94 h1:6PNsuNmSqCuR8Z61github.com/bytebase/pkcs8 v0.0.0-20240612095628-fcd0a7484c94/go.mod h1:SQliXeA7Dhkt//vS29v3zpbEwoa+zb2Cn5xj5uO4K5U=github.com/bytebase/plsql-parser v0.0.0-20241217100236-775726d725f9 h1:8G2E1ab2Zd6xIcWneXV6FLvuTr50Qzu5A/3KTvKrx8U=github.com/bytebase/plsql-parser v0.0.0-20241217100236-775726d725f9/go.mod h1:sEtLYOfHyi8zz5vo5gKT//A8c4P8FnDZLNVSLtVPxj0=-github.com/bytebase/postgresql-parser v0.0.0-20250211003522-336459624c54 h1:9VbMa0BCm3+CWdX++rfpG/GAu0D9alWmPQ+XqG7b4pg=-github.com/bytebase/postgresql-parser v0.0.0-20250211003522-336459624c54/go.mod h1:Jft7oabwuwD+t5BYiUfTjcNVaihZ8F5KT8TsROG0EaE=+github.com/bytebase/postgresql-parser v0.0.0-20250213053010-aeb8220eb3bb h1:MgBZKosw7Fp4GRx5OyXMFBLldgjOtRZZ/Lm8XCob5TU=+github.com/bytebase/postgresql-parser v0.0.0-20250213053010-aeb8220eb3bb/go.mod h1:Jft7oabwuwD+t5BYiUfTjcNVaihZ8F5KT8TsROG0EaE=github.com/bytebase/snowsql-parser v0.0.0-20250124075214-562d62e69c35 h1:eP0Ox7IGGROy2cdvWQP6mmFOZvNnoT8dUPJBUXCakec=github.com/bytebase/snowsql-parser v0.0.0-20250124075214-562d62e69c35/go.mod h1:gJ1aclz1e9xLArQTbCpDjL+A79Jt3Ro9+/QEw8A6vMM=github.com/bytebase/tidb-parser v0.0.0-20240821091609-162fffe2a839 h1:OLOEfNV20wqC4nPHQllr4mrMhchAhPrgXlKn0URgum8=