@intentius/chant-lexicon-sql 0.121.1 → 0.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/clickhouse/catalog-types.d.ts +8 -0
  2. package/dist/clickhouse/catalog-types.d.ts.map +1 -1
  3. package/dist/clickhouse/overlays/codecs.d.ts.map +1 -1
  4. package/dist/clickhouse/overlays/kinds.d.ts +1 -1
  5. package/dist/clickhouse/overlays/kinds.d.ts.map +1 -1
  6. package/dist/clickhouse/overlays/types.d.ts.map +1 -1
  7. package/dist/clickhouse/type-syntax.d.ts +33 -0
  8. package/dist/clickhouse/type-syntax.d.ts.map +1 -0
  9. package/dist/codegen/clickhouse-module.d.ts.map +1 -1
  10. package/dist/codegen/postgres-module.d.ts.map +1 -1
  11. package/dist/generated/clickhouse.d.ts +7 -1
  12. package/dist/generated/clickhouse.d.ts.map +1 -1
  13. package/dist/generated/postgres.d.ts +6 -0
  14. package/dist/generated/postgres.d.ts.map +1 -1
  15. package/dist/integrity.json +23 -5
  16. package/dist/lint/audit-catalog.d.ts.map +1 -1
  17. package/dist/lint/post-synth/audit-entries.d.ts.map +1 -1
  18. package/dist/lint/post-synth/clickhouse-type-check.d.ts +37 -0
  19. package/dist/lint/post-synth/clickhouse-type-check.d.ts.map +1 -0
  20. package/dist/lint/post-synth/index.d.ts.map +1 -1
  21. package/dist/lint/post-synth/postgres-audit-entries.d.ts.map +1 -1
  22. package/dist/lint/post-synth/postgres-names.d.ts +149 -0
  23. package/dist/lint/post-synth/postgres-names.d.ts.map +1 -0
  24. package/dist/lint/post-synth/sql101.d.ts +9 -0
  25. package/dist/lint/post-synth/sql101.d.ts.map +1 -0
  26. package/dist/lint/post-synth/sqlch121.d.ts +10 -0
  27. package/dist/lint/post-synth/sqlch121.d.ts.map +1 -0
  28. package/dist/lint/post-synth/sqlch122.d.ts +10 -0
  29. package/dist/lint/post-synth/sqlch122.d.ts.map +1 -0
  30. package/dist/lint/post-synth/sqlch123.d.ts +9 -0
  31. package/dist/lint/post-synth/sqlch123.d.ts.map +1 -0
  32. package/dist/lint/post-synth/sqlch124.d.ts +6 -0
  33. package/dist/lint/post-synth/sqlch124.d.ts.map +1 -0
  34. package/dist/lint/post-synth/sqlch125.d.ts +11 -0
  35. package/dist/lint/post-synth/sqlch125.d.ts.map +1 -0
  36. package/dist/lint/post-synth/sqlch126.d.ts +12 -0
  37. package/dist/lint/post-synth/sqlch126.d.ts.map +1 -0
  38. package/dist/lint/post-synth/sqlch127.d.ts +22 -0
  39. package/dist/lint/post-synth/sqlch127.d.ts.map +1 -0
  40. package/dist/lint/post-synth/sqlpg119.d.ts +18 -0
  41. package/dist/lint/post-synth/sqlpg119.d.ts.map +1 -0
  42. package/dist/lint/post-synth/sqlpg120.d.ts +17 -0
  43. package/dist/lint/post-synth/sqlpg120.d.ts.map +1 -0
  44. package/dist/lint/post-synth/sqlpg121.d.ts +12 -0
  45. package/dist/lint/post-synth/sqlpg121.d.ts.map +1 -0
  46. package/dist/lint/post-synth/sqlpg122.d.ts +12 -0
  47. package/dist/lint/post-synth/sqlpg122.d.ts.map +1 -0
  48. package/dist/lint/post-synth/sqlpg123.d.ts +17 -0
  49. package/dist/lint/post-synth/sqlpg123.d.ts.map +1 -0
  50. package/dist/lint/post-synth/sqlpg124.d.ts +16 -0
  51. package/dist/lint/post-synth/sqlpg124.d.ts.map +1 -0
  52. package/dist/lint/post-synth/sqlpg125.d.ts +17 -0
  53. package/dist/lint/post-synth/sqlpg125.d.ts.map +1 -0
  54. package/dist/lint/post-synth/sqlpg126.d.ts +19 -0
  55. package/dist/lint/post-synth/sqlpg126.d.ts.map +1 -0
  56. package/dist/manifest.json +1 -1
  57. package/dist/okf/index.md +16 -0
  58. package/dist/okf/rules/SQL101.md +23 -0
  59. package/dist/okf/rules/SQLCH121.md +11 -0
  60. package/dist/okf/rules/SQLCH122.md +11 -0
  61. package/dist/okf/rules/SQLCH123.md +11 -0
  62. package/dist/okf/rules/SQLCH124.md +18 -0
  63. package/dist/okf/rules/SQLCH125.md +11 -0
  64. package/dist/okf/rules/SQLCH126.md +15 -0
  65. package/dist/okf/rules/SQLCH127.md +15 -0
  66. package/dist/okf/rules/SQLPG119.md +16 -0
  67. package/dist/okf/rules/SQLPG120.md +16 -0
  68. package/dist/okf/rules/SQLPG121.md +11 -0
  69. package/dist/okf/rules/SQLPG122.md +15 -0
  70. package/dist/okf/rules/SQLPG123.md +16 -0
  71. package/dist/okf/rules/SQLPG124.md +11 -0
  72. package/dist/okf/rules/SQLPG125.md +11 -0
  73. package/dist/okf/rules/SQLPG126.md +11 -0
  74. package/dist/okf/types/Dictionary.md +4 -0
  75. package/dist/okf/types/Function.md +5 -0
  76. package/dist/okf/types/Grant.md +6 -0
  77. package/dist/okf/types/MaterializedView.md +1 -0
  78. package/dist/okf/types/PostgresDefaultPrivileges.md +4 -0
  79. package/dist/okf/types/PostgresDomain.md +2 -0
  80. package/dist/okf/types/PostgresEnum.md +1 -0
  81. package/dist/okf/types/PostgresFunction.md +4 -0
  82. package/dist/okf/types/PostgresGrant.md +5 -0
  83. package/dist/okf/types/PostgresPolicy.md +4 -0
  84. package/dist/okf/types/PostgresProcedure.md +4 -0
  85. package/dist/okf/types/PostgresSequence.md +2 -0
  86. package/dist/okf/types/PostgresTrigger.md +4 -0
  87. package/dist/okf/types/RowPolicy.md +4 -0
  88. package/dist/okf/types/Table.md +1 -0
  89. package/dist/okf/types/View.md +1 -0
  90. package/dist/postgres/overlays/extension-objects.d.ts +28 -0
  91. package/dist/postgres/overlays/extension-objects.d.ts.map +1 -0
  92. package/dist/postgres/overlays/types.d.ts +10 -0
  93. package/dist/postgres/overlays/types.d.ts.map +1 -1
  94. package/dist/rules/audit-entries.ts +7 -0
  95. package/dist/rules/clickhouse-type-check.ts +173 -0
  96. package/dist/rules/postgres-audit-entries.ts +8 -0
  97. package/dist/rules/postgres-names.ts +506 -0
  98. package/dist/rules/sql101.ts +62 -0
  99. package/dist/rules/sqlch121.ts +12 -0
  100. package/dist/rules/sqlch122.ts +12 -0
  101. package/dist/rules/sqlch123.ts +11 -0
  102. package/dist/rules/sqlch124.ts +21 -0
  103. package/dist/rules/sqlch125.ts +56 -0
  104. package/dist/rules/sqlch126.ts +57 -0
  105. package/dist/rules/sqlch127.ts +128 -0
  106. package/dist/rules/sqlpg119.ts +37 -0
  107. package/dist/rules/sqlpg120.ts +70 -0
  108. package/dist/rules/sqlpg121.ts +32 -0
  109. package/dist/rules/sqlpg122.ts +28 -0
  110. package/dist/rules/sqlpg123.ts +63 -0
  111. package/dist/rules/sqlpg124.ts +47 -0
  112. package/dist/rules/sqlpg125.ts +40 -0
  113. package/dist/rules/sqlpg126.ts +37 -0
  114. package/package.json +2 -2
  115. package/src/clickhouse/catalog-types.ts +9 -0
  116. package/src/clickhouse/overlays/codecs.ts +6 -2
  117. package/src/clickhouse/overlays/kinds.ts +1 -1
  118. package/src/clickhouse/overlays/types.ts +20 -3
  119. package/src/clickhouse/type-syntax.ts +82 -0
  120. package/src/codegen/clickhouse-module.ts +15 -1
  121. package/src/codegen/postgres-module.ts +43 -0
  122. package/src/composites/composites.test.ts +7 -6
  123. package/src/generated/clickhouse.ts +1905 -6
  124. package/src/generated/postgres.ts +2639 -0
  125. package/src/lint/audit-catalog.ts +8 -0
  126. package/src/lint/post-synth/audit-entries.ts +7 -0
  127. package/src/lint/post-synth/clickhouse-catalog-checks.test.ts +315 -0
  128. package/src/lint/post-synth/clickhouse-type-check.ts +173 -0
  129. package/src/lint/post-synth/index.ts +32 -0
  130. package/src/lint/post-synth/postgres-audit-entries.ts +8 -0
  131. package/src/lint/post-synth/postgres-checks.test.ts +214 -1
  132. package/src/lint/post-synth/postgres-names.ts +506 -0
  133. package/src/lint/post-synth/sql101.ts +62 -0
  134. package/src/lint/post-synth/sqlch121.ts +12 -0
  135. package/src/lint/post-synth/sqlch122.ts +12 -0
  136. package/src/lint/post-synth/sqlch123.ts +11 -0
  137. package/src/lint/post-synth/sqlch124.ts +21 -0
  138. package/src/lint/post-synth/sqlch125.ts +56 -0
  139. package/src/lint/post-synth/sqlch126.ts +57 -0
  140. package/src/lint/post-synth/sqlch127.ts +128 -0
  141. package/src/lint/post-synth/sqlpg119.ts +37 -0
  142. package/src/lint/post-synth/sqlpg120.ts +70 -0
  143. package/src/lint/post-synth/sqlpg121.ts +32 -0
  144. package/src/lint/post-synth/sqlpg122.ts +28 -0
  145. package/src/lint/post-synth/sqlpg123.ts +63 -0
  146. package/src/lint/post-synth/sqlpg124.ts +47 -0
  147. package/src/lint/post-synth/sqlpg125.ts +40 -0
  148. package/src/lint/post-synth/sqlpg126.ts +37 -0
  149. package/src/postgres/overlays/extension-objects.ts +100 -0
  150. package/src/postgres/overlays/types.ts +25 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg120.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/sqlpg120.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,2CAanB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * SQLPG121: an identity column whose type is not `smallint`, `integer` or
3
+ * `bigint`.
4
+ *
5
+ * Doc: https://www.postgresql.org/docs/18/sql-createtable.html ("GENERATED {
6
+ * ALWAYS | BY DEFAULT } AS IDENTITY ... The column ... must be of type
7
+ * smallint, integer or bigint"). The server refuses `identity column type must
8
+ * be smallint, integer, or bigint` at CREATE. A declared type (a domain) is
9
+ * left to the server.
10
+ */
11
+ export declare const sqlpg121: import("@intentius/chant").PostSynthCheck;
12
+ //# sourceMappingURL=sqlpg121.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg121.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/sqlpg121.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,2CAgBnB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * SQLPG122: a table that declares a column twice, or an enum that lists a
3
+ * label twice.
4
+ *
5
+ * Doc: https://www.postgresql.org/docs/18/sql-createtable.html and
6
+ * https://www.postgresql.org/docs/18/sql-createtype.html. The server refuses
7
+ * `column "id" specified more than once` and `enum labels must be unique`.
8
+ * Column names are compared as Postgres folds them; labels as written, since
9
+ * they are case-sensitive strings.
10
+ */
11
+ export declare const sqlpg122: import("@intentius/chant").PostSynthCheck;
12
+ //# sourceMappingURL=sqlpg122.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg122.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/sqlpg122.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,2CAYnB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * SQLPG123: a bare column name in a key, index or grant column list that the
3
+ * table does not declare.
4
+ *
5
+ * Doc: https://www.postgresql.org/docs/18/sql-createtable.html,
6
+ * https://www.postgresql.org/docs/18/sql-createindex.html,
7
+ * https://www.postgresql.org/docs/18/sql-grant.html. The server refuses
8
+ * `column "idd" named in key does not exist` (or `column "emial" does not
9
+ * exist`) at CREATE or GRANT. Checked: `PRIMARY KEY`, `UNIQUE` and their
10
+ * `INCLUDE`, a foreign key's own columns, an index's bare columns and
11
+ * `INCLUDE` on a `${}` table, and a `GRANT`/`REVOKE` column list on a `${}`
12
+ * table. An expression (an index expression, a CHECK, a generated column) is
13
+ * left to the server, as is a table whose columns come from somewhere the
14
+ * build cannot see (`LIKE`, `OF type`, a plain-text parent).
15
+ */
16
+ export declare const sqlpg123: import("@intentius/chant").PostSynthCheck;
17
+ //# sourceMappingURL=sqlpg123.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg123.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/sqlpg123.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,2CA4CnB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * SQLPG124: a foreign key to a `${}` table that names a column the table does
3
+ * not declare, or pairs columns whose types do not compare.
4
+ *
5
+ * Doc: https://www.postgresql.org/docs/18/ddl-constraints.html#DDL-CONSTRAINTS-FK
6
+ * and https://www.postgresql.org/docs/18/catalog-pg-type.html#CATALOG-TYPCATEGORY-TABLE.
7
+ * The server refuses `column "idd" referenced in foreign key constraint does
8
+ * not exist` and `Key columns "customer_id" and "id" are of incompatible
9
+ * types: text and bigint`. Types compare by their catalog category: `integer`
10
+ * to `bigint` (both numeric) passes, `text` to `bigint` fails. The
11
+ * user-defined category (`uuid`, `bytea`, `jsonb`...) compares by type; a
12
+ * domain by its base type; an enum by itself. A key to a table named in plain
13
+ * text, or a type outside the project, is left to the server.
14
+ */
15
+ export declare const sqlpg124: import("@intentius/chant").PostSynthCheck;
16
+ //# sourceMappingURL=sqlpg124.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg124.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/sqlpg124.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,QAAQ,2CA6BnB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * SQLPG125: an index access method or operator class the target major does
3
+ * not have, or an operator class that is not for the index's method.
4
+ *
5
+ * Doc: https://www.postgresql.org/docs/18/sql-createindex.html and
6
+ * https://www.postgresql.org/docs/18/indexes-opclass.html. The server refuses
7
+ * `access method "btreee" does not exist` and `operator class "numeric_opz"
8
+ * does not exist for access method "btree"` at CREATE. Methods and operator
9
+ * classes come from the target major's catalog (`pg_am`, `pg_opclass`). The
10
+ * ones an extension adds (`gin_trgm_ops` from pg_trgm, `hnsw` from vector)
11
+ * pass when the project declares that extension and are an error naming it
12
+ * when it does not; one neither the catalog nor the extension overlay knows is
13
+ * a warning when the project declares any extension. An operator class
14
+ * qualified with a schema the project does not declare is left alone.
15
+ */
16
+ export declare const sqlpg125: import("@intentius/chant").PostSynthCheck;
17
+ //# sourceMappingURL=sqlpg125.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg125.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/sqlpg125.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,2CAqBnB,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * SQLPG126: a call to a function the target major does not have, in a column
3
+ * `DEFAULT`, a generated column, a `CHECK` (a table's or a domain's), or an
4
+ * index expression.
5
+ *
6
+ * Doc: https://www.postgresql.org/docs/18/functions.html. The server refuses
7
+ * `function noww() does not exist` at CREATE. A name counts when it is in
8
+ * the target major's `pg_proc`, a function or procedure the project declares,
9
+ * a type name used as a cast (`int4(x)`), or qualified with a schema the
10
+ * project does not declare. Only a name directly followed by `(`, outside
11
+ * string literals, is a call; the grammar's own constructs that read like
12
+ * calls (`COALESCE`, `NULLIF`, `GREATEST`, `LEAST`, `CAST`, `EXTRACT`, `ROW`,
13
+ * `ARRAY`, `EXISTS`, `IN`, `ANY`, `ALL`, `SOME`, and the key word forms of
14
+ * `OVERLAY`, `POSITION`, `SUBSTRING` and `TRIM`) are reserved or column-name
15
+ * key words, not `pg_proc` names, and are skipped by their key word category.
16
+ * An error, or a warning when the project declares an extension.
17
+ */
18
+ export declare const sqlpg126: import("@intentius/chant").PostSynthCheck;
19
+ //# sourceMappingURL=sqlpg126.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg126.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/sqlpg126.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,2CAgBnB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sql",
3
- "version": "0.121.1",
3
+ "version": "0.122.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "SQL",
6
6
  "intrinsics": [],
package/dist/okf/index.md CHANGED
@@ -33,6 +33,7 @@ okf_version: '0.2'
33
33
 
34
34
  # Rules
35
35
 
36
+ * [SQL101](/rules/SQL101.md) - Two exports declare the same object
36
37
  * [SQLCH001](/rules/SQLCH001.md) - the DDL in a ClickHouse template (`database`, `table`, `view`, `dictionary`, `func`, `user`, `role`, `policy`, `grant`) does not parse, or holds another stat...
37
38
  * [SQLCH002](/rules/SQLCH002.md) - a `Nullable` column in a table's sort key or primary key.
38
39
  * [SQLCH003](/rules/SQLCH003.md) - a column written as `${events.kind}` instead of `${events.columns.kind}`.
@@ -56,6 +57,13 @@ okf_version: '0.2'
56
57
  * [SQLCH118](/rules/SQLCH118.md) - A MergeTree setting is not one the pinned server has
57
58
  * [SQLCH119](/rules/SQLCH119.md) - An object uses a deprecated or experimental engine
58
59
  * [SQLCH120](/rules/SQLCH120.md) - A MergeTree engine uses the deprecated positional arguments
60
+ * [SQLCH121](/rules/SQLCH121.md) - A column type names a family the pinned server does not have
61
+ * [SQLCH122](/rules/SQLCH122.md) - A column type's parameters do not fit its family
62
+ * [SQLCH123](/rules/SQLCH123.md) - A Nullable wraps a type ClickHouse does not allow inside Nullable
63
+ * [SQLCH124](/rules/SQLCH124.md) - A table declares a column twice
64
+ * [SQLCH125](/rules/SQLCH125.md) - A codec parameter is outside what the codec takes
65
+ * [SQLCH126](/rules/SQLCH126.md) - A GRANT column list names a column the table does not declare
66
+ * [SQLCH127](/rules/SQLCH127.md) - An expression calls a function the pinned server does not have
59
67
  * [SQLPG001](/rules/SQLPG001.md) - the DDL in a Postgres template does not parse, or does not hold
60
68
  * [SQLPG002](/rules/SQLPG002.md) - a column written as `${events.kind}` instead of `${events.columns.kind}`.
61
69
  * [SQLPG003](/rules/SQLPG003.md) - an object named in a string where Postgres reads a `regclass`:
@@ -78,3 +86,11 @@ okf_version: '0.2'
78
86
  * [SQLPG116](/rules/SQLPG116.md) - An extension the target major no longer ships
79
87
  * [SQLPG117](/rules/SQLPG117.md) - A view without security_invoker runs with its owner's privileges
80
88
  * [SQLPG118](/rules/SQLPG118.md) - A table uses INHERITS where declarative partitioning replaced it
89
+ * [SQLPG119](/rules/SQLPG119.md) - A column, domain or sequence type the target major does not have
90
+ * [SQLPG120](/rules/SQLPG120.md) - A type modifier that does not fit the type
91
+ * [SQLPG121](/rules/SQLPG121.md) - An identity column whose type is not smallint, integer or bigint
92
+ * [SQLPG122](/rules/SQLPG122.md) - A table declares a column twice, or an enum lists a label twice
93
+ * [SQLPG123](/rules/SQLPG123.md) - A key, index or grant column list names a column the table does not declare
94
+ * [SQLPG124](/rules/SQLPG124.md) - A foreign key names a column the referenced table lacks, or one of another type category
95
+ * [SQLPG125](/rules/SQLPG125.md) - An index access method or operator class the target major does not have, or not for that method
96
+ * [SQLPG126](/rules/SQLPG126.md) - An expression calls a function the target major does not have
@@ -0,0 +1,23 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQL101
4
+ description: Two exports declare the same object
5
+ id: SQL101
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ Two exports declare the same object
12
+
13
+ ## Applies to
14
+
15
+ - [Function](/types/Function.md)
16
+ - [Grant](/types/Grant.md)
17
+ - [PostgresDefaultPrivileges](/types/PostgresDefaultPrivileges.md)
18
+ - [PostgresFunction](/types/PostgresFunction.md)
19
+ - [PostgresGrant](/types/PostgresGrant.md)
20
+ - [PostgresPolicy](/types/PostgresPolicy.md)
21
+ - [PostgresProcedure](/types/PostgresProcedure.md)
22
+ - [PostgresTrigger](/types/PostgresTrigger.md)
23
+ - [RowPolicy](/types/RowPolicy.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH121
4
+ description: A column type names a family the pinned server does not have
5
+ id: SQLCH121
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A column type names a family the pinned server does not have
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH122
4
+ description: A column type's parameters do not fit its family
5
+ id: SQLCH122
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A column type's parameters do not fit its family
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH123
4
+ description: A Nullable wraps a type ClickHouse does not allow inside Nullable
5
+ id: SQLCH123
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A Nullable wraps a type ClickHouse does not allow inside Nullable
@@ -0,0 +1,18 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH124
4
+ description: A table declares a column twice
5
+ id: SQLCH124
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A table declares a column twice
12
+
13
+ ## Applies to
14
+
15
+ - [Dictionary](/types/Dictionary.md)
16
+ - [MaterializedView](/types/MaterializedView.md)
17
+ - [Table](/types/Table.md)
18
+ - [View](/types/View.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH125
4
+ description: A codec parameter is outside what the codec takes
5
+ id: SQLCH125
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A codec parameter is outside what the codec takes
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH126
4
+ description: A GRANT column list names a column the table does not declare
5
+ id: SQLCH126
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A GRANT column list names a column the table does not declare
12
+
13
+ ## Applies to
14
+
15
+ - [Grant](/types/Grant.md)
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH127
4
+ description: An expression calls a function the pinned server does not have
5
+ id: SQLCH127
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An expression calls a function the pinned server does not have
12
+
13
+ ## Applies to
14
+
15
+ - [Function](/types/Function.md)
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG119
4
+ description: A column, domain or sequence type the target major does not have
5
+ id: SQLPG119
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A column, domain or sequence type the target major does not have
12
+
13
+ ## Applies to
14
+
15
+ - [PostgresDomain](/types/PostgresDomain.md)
16
+ - [PostgresSequence](/types/PostgresSequence.md)
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG120
4
+ description: A type modifier that does not fit the type
5
+ id: SQLPG120
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A type modifier that does not fit the type
12
+
13
+ ## Applies to
14
+
15
+ - [PostgresDomain](/types/PostgresDomain.md)
16
+ - [PostgresSequence](/types/PostgresSequence.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG121
4
+ description: An identity column whose type is not smallint, integer or bigint
5
+ id: SQLPG121
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An identity column whose type is not smallint, integer or bigint
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG122
4
+ description: A table declares a column twice, or an enum lists a label twice
5
+ id: SQLPG122
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A table declares a column twice, or an enum lists a label twice
12
+
13
+ ## Applies to
14
+
15
+ - [PostgresEnum](/types/PostgresEnum.md)
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG123
4
+ description: A key, index or grant column list names a column the table does not declare
5
+ id: SQLPG123
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A key, index or grant column list names a column the table does not declare
12
+
13
+ ## Applies to
14
+
15
+ - [Grant](/types/Grant.md)
16
+ - [PostgresGrant](/types/PostgresGrant.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG124
4
+ description: A foreign key names a column the referenced table lacks, or one of another type category
5
+ id: SQLPG124
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A foreign key names a column the referenced table lacks, or one of another type category
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG125
4
+ description: An index access method or operator class the target major does not have, or not for that method
5
+ id: SQLPG125
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An index access method or operator class the target major does not have, or not for that method
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG126
4
+ description: An expression calls a function the target major does not have
5
+ id: SQLPG126
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An expression calls a function the target major does not have
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: ClickHouse::Dictionary
8
8
  ---
9
9
  `ClickHouse::Dictionary`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
@@ -7,3 +7,8 @@ lexicon: sql
7
7
  resource_type: ClickHouse::Function
8
8
  ---
9
9
  `ClickHouse::Function`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
14
+ - [SQLCH127](/rules/SQLCH127.md): An expression calls a function the pinned server does not have
@@ -7,3 +7,9 @@ lexicon: sql
7
7
  resource_type: ClickHouse::Grant
8
8
  ---
9
9
  `ClickHouse::Grant`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
14
+ - [SQLCH126](/rules/SQLCH126.md): A GRANT column list names a column the table does not declare
15
+ - [SQLPG123](/rules/SQLPG123.md): A key, index or grant column list names a column the table does not declare
@@ -11,4 +11,5 @@ resource_type: ClickHouse::MaterializedView
11
11
  ## Governed by
12
12
 
13
13
  - [SQLCH117](/rules/SQLCH117.md): A MergeTree setting is obsolete at the pinned server
14
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
14
15
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::DefaultPrivileges
8
8
  ---
9
9
  `Postgres::DefaultPrivileges`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -11,3 +11,5 @@ resource_type: Postgres::Domain
11
11
  ## Governed by
12
12
 
13
13
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
14
+ - [SQLPG119](/rules/SQLPG119.md): A column, domain or sequence type the target major does not have
15
+ - [SQLPG120](/rules/SQLPG120.md): A type modifier that does not fit the type
@@ -11,3 +11,4 @@ resource_type: Postgres::Enum
11
11
  ## Governed by
12
12
 
13
13
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
14
+ - [SQLPG122](/rules/SQLPG122.md): A table declares a column twice, or an enum lists a label twice
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Function
8
8
  ---
9
9
  `Postgres::Function`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -7,3 +7,8 @@ lexicon: sql
7
7
  resource_type: Postgres::Grant
8
8
  ---
9
9
  `Postgres::Grant`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
14
+ - [SQLPG123](/rules/SQLPG123.md): A key, index or grant column list names a column the table does not declare
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Policy
8
8
  ---
9
9
  `Postgres::Policy`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Procedure
8
8
  ---
9
9
  `Postgres::Procedure`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -11,3 +11,5 @@ resource_type: Postgres::Sequence
11
11
  ## Governed by
12
12
 
13
13
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
14
+ - [SQLPG119](/rules/SQLPG119.md): A column, domain or sequence type the target major does not have
15
+ - [SQLPG120](/rules/SQLPG120.md): A type modifier that does not fit the type
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Trigger
8
8
  ---
9
9
  `Postgres::Trigger`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: ClickHouse::RowPolicy
8
8
  ---
9
9
  `ClickHouse::RowPolicy`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -12,4 +12,5 @@ resource_type: ClickHouse::Table
12
12
 
13
13
  - [SQLCH118](/rules/SQLCH118.md): A MergeTree setting is not one the pinned server has
14
14
  - [SQLCH120](/rules/SQLCH120.md): A MergeTree engine uses the deprecated positional arguments
15
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
15
16
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
@@ -10,4 +10,5 @@ resource_type: ClickHouse::View
10
10
 
11
11
  ## Governed by
12
12
 
13
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
13
14
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
@@ -0,0 +1,28 @@
1
+ /**
2
+ * What the common extensions add, for lint: the types, functions, index
3
+ * access methods and operator classes a declaration may name once the project
4
+ * declares the extension. The pinned catalogs are read from a server with no
5
+ * extension installed, so none of these are in them.
6
+ *
7
+ * The list is not exhaustive. A name the core catalog does not have and no
8
+ * entry here covers is reported as a warning when the project declares any
9
+ * extension (it may come from one), and as an error when it declares none.
10
+ * A name an entry here covers, used without that extension declared, is an
11
+ * error that names the extension.
12
+ *
13
+ * Sources: the reference page of each contrib module
14
+ * (https://www.postgresql.org/docs/18/contrib.html), PostGIS
15
+ * (https://postgis.net/docs/reference.html) and pgvector
16
+ * (https://github.com/pgvector/pgvector#reference).
17
+ */
18
+ export interface ExtensionObjects {
19
+ types?: readonly string[];
20
+ functions?: readonly string[];
21
+ /** Function name prefixes the extension owns (`st_` for PostGIS). */
22
+ functionPrefixes?: readonly string[];
23
+ accessMethods?: readonly string[];
24
+ /** Operator classes by access method. */
25
+ opclasses?: Readonly<Record<string, readonly string[]>>;
26
+ }
27
+ export declare const EXTENSION_OBJECTS: Readonly<Record<string, ExtensionObjects>>;
28
+ //# sourceMappingURL=extension-objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-objects.d.ts","sourceRoot":"","sources":["../../../src/postgres/overlays/extension-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,yCAAyC;IACzC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;CACzD;AAgBD,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAyDxE,CAAC"}
@@ -21,4 +21,14 @@ export declare const ARRAY_SUFFIX: {
21
21
  readonly dimensioned: "[n]";
22
22
  readonly keyword: "ARRAY";
23
23
  };
24
+ /**
25
+ * Spellings the grammar accepts that neither `pg_type` nor {@link TYPE_SPELLINGS}
26
+ * lists, and the canonical name each stands for (gram.y, `Numeric`,
27
+ * `Character`, `ConstDatetime`). Lint reads them beside the catalog so every
28
+ * spelling Postgres accepts resolves. `float(p)` is `real` for p up to 24 and
29
+ * `double precision` above; lint reads the precision.
30
+ */
31
+ export declare const GRAMMAR_TYPE_SPELLINGS: Record<string, string>;
32
+ /** The serial spellings with a width suffix, beside {@link SERIAL_TYPES}. */
33
+ export declare const SERIAL_WIDTH_SPELLINGS: Record<string, string>;
24
34
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/postgres/overlays/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAO,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAEnD,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAiB5E,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWjD,CAAC;AAEF,gHAAgH;AAChH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI/C,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,YAAY;;;;CAAoE,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/postgres/overlays/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAO,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAEnD,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,CAiB5E,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAWjD,CAAC;AAEF,gHAAgH;AAChH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI/C,CAAC;AAEF,yGAAyG;AACzG,eAAO,MAAM,YAAY;;;;CAAoE,CAAC;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASzD,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIzD,CAAC"}
@@ -26,4 +26,11 @@ export const sqlPostSynthAuditEntries: Record<string, RuleMeta> = {
26
26
  SQLCH118: auditRule("SQLCH118", "merge-worthy", "guidance", "A MergeTree setting is not one the pinned server has", "Fix the setting name, or pick a setting from the pinned server's system.merge_tree_settings.", { category: "correctness" }),
27
27
  SQLCH119: auditRule("SQLCH119", "report-only", "guidance", "An object uses a deprecated or experimental engine", "Use the engine that replaced it (Atomic for Ordinary), or accept the experimental engine knowingly.", { category: "best-practice" }),
28
28
  SQLCH120: auditRule("SQLCH120", "report-only", "guidance", "A MergeTree engine uses the deprecated positional arguments", "Write a bare MergeTree with ORDER BY, PARTITION BY and SETTINGS.", { category: "best-practice" }),
29
+ SQLCH121: auditRule("SQLCH121", "merge-worthy", "guidance", "A column type names a family the pinned server does not have", "Use a type family from the pinned server's system.data_type_families, in the case it lists unless it is case-insensitive.", { category: "correctness" }),
30
+ SQLCH122: auditRule("SQLCH122", "merge-worthy", "guidance", "A column type's parameters do not fit its family", "Give the family the parameters it takes, each within its range.", { category: "correctness" }),
31
+ SQLCH123: auditRule("SQLCH123", "merge-worthy", "guidance", "A Nullable wraps a type ClickHouse does not allow inside Nullable", "Move Nullable inside (Array(Nullable(T)), LowCardinality(Nullable(T))) or drop it.", { category: "correctness" }),
32
+ SQLCH124: auditRule("SQLCH124", "merge-worthy", "guidance", "A table declares a column twice", "Remove or rename one of the two columns.", { category: "correctness" }),
33
+ SQLCH125: auditRule("SQLCH125", "merge-worthy", "guidance", "A codec parameter is outside what the codec takes", "Give the codec a parameter within its range or set, or drop the parameter for the default.", { category: "correctness" }),
34
+ SQLCH126: auditRule("SQLCH126", "merge-worthy", "guidance", "A GRANT column list names a column the table does not declare", "Fix the column name, or declare the column on the table.", { category: "correctness" }),
35
+ SQLCH127: auditRule("SQLCH127", "merge-worthy", "guidance", "An expression calls a function the pinned server does not have", "Fix the function name, use one from the pinned server's system.functions, or declare it with func.", { category: "correctness" }),
29
36
  };