Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: move postgres keyword to a separate file so that the main driver file is more concise (#653)

Danny Xu7af8fe398847
diff --git a/plugin/db/pg/keyword.go b/plugin/db/pg/keyword.go
new file mode 100644
index 0000000000..7a89c40c59
--- /dev/null
+++ b/plugin/db/pg/keyword.go
@@ -0,0 +1,152 @@
+package pg
+
+var (
+ reserved = map[string]bool{
+ "AES128": true,
+ "AES256": true,
+ "ALL": true,
+ "ALLOWOVERWRITE": true,
+ "ANALYSE": true,
+ "ANALYZE": true,
+ "AND": true,
+ "ANY": true,
+ "ARRAY": true,
+ "AS": true,
+ "ASC": true,
+ "AUTHORIZATION": true,
+ "BACKUP": true,
+ "BETWEEN": true,
+ "BINARY": true,
+ "BLANKSASNULL": true,
+ "BOTH": true,
+ "BYTEDICT": true,
+ "CASE": true,
+ "CAST": true,
+ "CHECK": true,
+ "COLLATE": true,
+ "COLUMN": true,
+ "CONSTRAINT": true,
+ "CREATE": true,
+ "CREDENTIALS": true,
+ "CROSS": true,
+ "CURRENT_DATE": true,
+ "CURRENT_TIME": true,
+ "CURRENT_TIMESTAMP": true,
+ "CURRENT_USER": true,
+ "CURRENT_USER_ID": true,
+ "DEFAULT": true,
+ "DEFERRABLE": true,
+ "DEFLATE": true,
+ "DEFRAG": true,
+ "DELTA": true,
+ "DELTA32K": true,
+ "DESC": true,
+ "DISABLE": true,
+ "DISTINCT": true,
+ "DO": true,
+ "ELSE": true,
+ "EMPTYASNULL": true,
+ "ENABLE": true,
+ "ENCODE": true,
+ "ENCRYPT": true,
+ "ENCRYPTION": true,
+ "END": true,
+ "EXCEPT": true,
+ "EXPLICIT": true,
+ "FALSE": true,
+ "FOR": true,
+ "FOREIGN": true,
+ "FREEZE": true,
+ "FROM": true,
+ "FULL": true,
+ "GLOBALDICT256": true,
+ "GLOBALDICT64K": true,
+ "GRANT": true,
+ "GROUP": true,
+ "GZIP": true,
+ "HAVING": true,
+ "IDENTITY": true,
+ "IGNORE": true,
+ "ILIKE": true,
+ "IN": true,
+ "INITIALLY": true,
+ "INNER": true,
+ "INTERSECT": true,
+ "INTO": true,
+ "IS": true,
+ "ISNULL": true,
+ "JOIN": true,
+ "LEADING": true,
+ "LEFT": true,
+ "LIKE": true,
+ "LIMIT": true,
+ "LOCALTIME": true,
+ "LOCALTIMESTAMP": true,
+ "LUN": true,
+ "LUNS": true,
+ "LZO": true,
+ "LZOP": true,
+ "MINUS": true,
+ "MOSTLY13": true,
+ "MOSTLY32": true,
+ "MOSTLY8": true,
+ "NATURAL": true,
+ "NEW": true,
+ "NOT": true,
+ "NOTNULL": true,
+ "NULL": true,
+ "NULLS": true,
+ "OFF": true,
+ "OFFLINE": true,
+ "OFFSET": true,
+ "OLD": true,
+ "ON": true,
+ "ONLY": true,
+ "OPEN": true,
+ "OR": true,
+ "ORDER": true,
+ "OUTER": true,
+ "OVERLAPS": true,
+ "PARALLEL": true,
+ "PARTITION": true,
+ "PERCENT": true,
+ "PLACING": true,
+ "PRIMARY": true,
+ "RAW": true,
+ "READRATIO": true,
+ "RECOVER": true,
+ "REFERENCES": true,
+ "REJECTLOG": true,
+ "RESORT": true,
+ "RESTORE": true,
+ "RIGHT": true,
+ "SELECT": true,
+ "SESSION_USER": true,
+ "SIMILAR": true,
+ "SOME": true,
+ "SYSDATE": true,
+ "SYSTEM": true,
+ "TABLE": true,
+ "TAG": true,
+ "TDES": true,
+ "TEXT255": true,
+ "TEXT32K": true,
+ "THEN": true,
+ "TO": true,
+ "TOP": true,
+ "TRAILING": true,
+ "TRUE": true,
+ "TRUNCATECOLUMNS": true,
+ "UNION": true,
+ "UNIQUE": true,
+ "USER": true,
+ "USING": true,
+ "VERBOSE": true,
+ "WALLET": true,
+ "WHEN": true,
+ "WHERE": true,
+ "WITH": true,
+ "WITHIN": true,
+ "WITHOUT": true,
+ }
+)
diff --git a/plugin/db/pg/pg.go b/plugin/db/pg/pg.go
index 204fd59df2..7f032e8c83 100644
--- a/plugin/db/pg/pg.go
+++ b/plugin/db/pg/pg.go
@@ -28,154 +28,6 @@ var (
"template0": true,
"template1": true,
}
- reserved = map[string]bool{
- "AES128": true,
- "AES256": true,
- "ALL": true,
- "ALLOWOVERWRITE": true,
- "ANALYSE": true,
- "ANALYZE": true,
- "AND": true,
- "ANY": true,
- "ARRAY": true,
- "AS": true,
- "ASC": true,
- "AUTHORIZATION": true,
- "BACKUP": true,
- "BETWEEN": true,
- "BINARY": true,
- "BLANKSASNULL": true,
- "BOTH": true,
- "BYTEDICT": true,
- "CASE": true,
- "CAST": true,
- "CHECK": true,
- "COLLATE": true,
- "COLUMN": true,
- "CONSTRAINT": true,
- "CREATE": true,
- "CREDENTIALS": true,
- "CROSS": true,
- "CURRENT_DATE": true,
- "CURRENT_TIME": true,
- "CURRENT_TIMESTAMP": true,
- "CURRENT_USER": true,
- "CURRENT_USER_ID": true,
- "DEFAULT": true,
- "DEFERRABLE": true,
- "DEFLATE": true,
- "DEFRAG": true,
- "DELTA": true,
- "DELTA32K": true,
- "DESC": true,
- "DISABLE": true,
- "DISTINCT": true,
- "DO": true,
- "ELSE": true,
- "EMPTYASNULL": true,
- "ENABLE": true,
- "ENCODE": true,
- "ENCRYPT": true,
- "ENCRYPTION": true,
- "END": true,
- "EXCEPT": true,
- "EXPLICIT": true,
- "FALSE": true,
- "FOR": true,
- "FOREIGN": true,
- "FREEZE": true,
- "FROM": true,
- "FULL": true,
- "GLOBALDICT256": true,
- "GLOBALDICT64K": true,
- "GRANT": true,
- "GROUP": true,
- "GZIP": true,
- "HAVING": true,
- "IDENTITY": true,
- "IGNORE": true,
- "ILIKE": true,
- "IN": true,
- "INITIALLY": true,
- "INNER": true,
- "INTERSECT": true,
- "INTO": true,
- "IS": true,
- "ISNULL": true,
- "JOIN": true,
- "LEADING": true,
- "LEFT": true,
- "LIKE": true,
- "LIMIT": true,
- "LOCALTIME": true,
- "LOCALTIMESTAMP": true,
- "LUN": true,
- "LUNS": true,
- "LZO": true,
- "LZOP": true,
- "MINUS": true,
- "MOSTLY13": true,
- "MOSTLY32": true,
- "MOSTLY8": true,
- "NATURAL": true,
- "NEW": true,
- "NOT": true,
- "NOTNULL": true,
- "NULL": true,
- "NULLS": true,
- "OFF": true,
- "OFFLINE": true,
- "OFFSET": true,
- "OLD": true,
- "ON": true,
- "ONLY": true,
- "OPEN": true,
- "OR": true,
- "ORDER": true,
- "OUTER": true,
- "OVERLAPS": true,
- "PARALLEL": true,
- "PARTITION": true,
- "PERCENT": true,
- "PLACING": true,
- "PRIMARY": true,
- "RAW": true,
- "READRATIO": true,
- "RECOVER": true,
- "REFERENCES": true,
- "REJECTLOG": true,
- "RESORT": true,
- "RESTORE": true,
- "RIGHT": true,
- "SELECT": true,
- "SESSION_USER": true,
- "SIMILAR": true,
- "SOME": true,
- "SYSDATE": true,
- "SYSTEM": true,
- "TABLE": true,
- "TAG": true,
- "TDES": true,
- "TEXT255": true,
- "TEXT32K": true,
- "THEN": true,
- "TO": true,
- "TOP": true,
- "TRAILING": true,
- "TRUE": true,
- "TRUNCATECOLUMNS": true,
- "UNION": true,
- "UNIQUE": true,
- "USER": true,
- "USING": true,
- "VERBOSE": true,
- "WALLET": true,
- "WHEN": true,
- "WHERE": true,
- "WITH": true,
- "WITHIN": true,
- "WITHOUT": true,
- }
ident = regexp.MustCompile(`(?i)^[a-z_][a-z0-9_$]*$`)
databaseHeaderFmt = "" +
"--\n" +