@intentius/chant-lexicon-sql 0.124.18 → 0.124.21
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.
- package/dist/clickhouse/access.d.ts +36 -7
- package/dist/clickhouse/access.d.ts.map +1 -1
- package/dist/clickhouse/apply/statements.d.ts.map +1 -1
- package/dist/clickhouse/entities.d.ts +60 -0
- package/dist/clickhouse/entities.d.ts.map +1 -1
- package/dist/clickhouse/import/generator.d.ts +1 -7
- package/dist/clickhouse/import/generator.d.ts.map +1 -1
- package/dist/clickhouse/import/live-export.d.ts +8 -0
- package/dist/clickhouse/import/live-export.d.ts.map +1 -1
- package/dist/clickhouse/live/catalog.d.ts +6 -5
- package/dist/clickhouse/live/catalog.d.ts.map +1 -1
- package/dist/clickhouse/live/describe-resources.d.ts.map +1 -1
- package/dist/clickhouse/live/undeclarable.d.ts +32 -0
- package/dist/clickhouse/live/undeclarable.d.ts.map +1 -0
- package/dist/clickhouse/parser.d.ts +16 -0
- package/dist/clickhouse/parser.d.ts.map +1 -1
- package/dist/clickhouse/plan/deep.d.ts.map +1 -1
- package/dist/clickhouse/plan/diff.d.ts.map +1 -1
- package/dist/clickhouse/plan/normalize.d.ts +6 -3
- package/dist/clickhouse/plan/normalize.d.ts.map +1 -1
- package/dist/clickhouse/plan/rules.d.ts +3 -0
- package/dist/clickhouse/plan/rules.d.ts.map +1 -1
- package/dist/clickhouse/testing/fake-server.d.ts +6 -0
- package/dist/clickhouse/testing/fake-server.d.ts.map +1 -1
- package/dist/clickhouse/topology.d.ts.map +1 -1
- package/dist/clickhouse.d.ts +1 -1
- package/dist/clickhouse.d.ts.map +1 -1
- package/dist/codegen/coverage-page.d.ts +7 -0
- package/dist/codegen/coverage-page.d.ts.map +1 -0
- package/dist/codegen/docs.d.ts.map +1 -1
- package/dist/codegen/registry.d.ts.map +1 -1
- package/dist/core/undeclarable.d.ts +38 -0
- package/dist/core/undeclarable.d.ts.map +1 -0
- package/dist/coverage/clickhouse-commands.json +24 -0
- package/dist/coverage/clickhouse.json +25 -0
- package/dist/coverage/postgres-commands.json +245 -0
- package/dist/coverage/postgres.json +51 -0
- package/dist/coverage.d.ts +68 -0
- package/dist/coverage.d.ts.map +1 -1
- package/dist/files/clickhouse.d.ts +2 -1
- package/dist/files/clickhouse.d.ts.map +1 -1
- package/dist/files/common.d.ts +12 -0
- package/dist/files/common.d.ts.map +1 -1
- package/dist/files/postgres.d.ts +1 -1
- package/dist/files/postgres.d.ts.map +1 -1
- package/dist/import-parser.d.ts +7 -2
- package/dist/import-parser.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/integrity.json +10 -10
- package/dist/lint/post-synth/postgres-names.d.ts.map +1 -1
- package/dist/lint/post-synth/sql101.d.ts.map +1 -1
- package/dist/lint/rules/sqlch001.d.ts +1 -1
- package/dist/lint/rules/sqlch001.d.ts.map +1 -1
- package/dist/lint/rules/sqlpg001.d.ts.map +1 -1
- package/dist/lint/rules/templates.d.ts +1 -1
- package/dist/lint/rules/templates.d.ts.map +1 -1
- package/dist/lsp/postgres-template.d.ts.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/meta.json +40 -0
- package/dist/okf/index.md +9 -1
- package/dist/okf/rules/SQL101.md +1 -0
- package/dist/okf/rules/SQLCH001.md +2 -2
- package/dist/okf/rules/SQLPG113.md +2 -0
- package/dist/okf/types/PostgresAggregate.md +13 -0
- package/dist/okf/types/PostgresCast.md +9 -0
- package/dist/okf/types/PostgresCollation.md +9 -0
- package/dist/okf/types/PostgresCompositeType.md +13 -0
- package/dist/okf/types/PostgresEventTrigger.md +9 -0
- package/dist/okf/types/PostgresRangeType.md +13 -0
- package/dist/okf/types/Quota.md +9 -0
- package/dist/okf/types/SettingsProfile.md +9 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/postgres/apply/apply.d.ts.map +1 -1
- package/dist/postgres/apply/statements.d.ts +4 -3
- package/dist/postgres/apply/statements.d.ts.map +1 -1
- package/dist/postgres/entities.d.ts +129 -6
- package/dist/postgres/entities.d.ts.map +1 -1
- package/dist/postgres/entity-types.d.ts +6 -0
- package/dist/postgres/entity-types.d.ts.map +1 -1
- package/dist/postgres/import/generator.d.ts +3 -2
- package/dist/postgres/import/generator.d.ts.map +1 -1
- package/dist/postgres/import/live-export.d.ts +8 -0
- package/dist/postgres/import/live-export.d.ts.map +1 -1
- package/dist/postgres/live/catalog-kinds.d.ts +28 -0
- package/dist/postgres/live/catalog-kinds.d.ts.map +1 -0
- package/dist/postgres/live/catalog.d.ts +23 -8
- package/dist/postgres/live/catalog.d.ts.map +1 -1
- package/dist/postgres/live/describe-resources.d.ts.map +1 -1
- package/dist/postgres/live/undeclarable.d.ts +42 -0
- package/dist/postgres/live/undeclarable.d.ts.map +1 -0
- package/dist/postgres/parser.d.ts +88 -5
- package/dist/postgres/parser.d.ts.map +1 -1
- package/dist/postgres/plan/deep.d.ts.map +1 -1
- package/dist/postgres/plan/diff.d.ts.map +1 -1
- package/dist/postgres/plan/normalize.d.ts +17 -2
- package/dist/postgres/plan/normalize.d.ts.map +1 -1
- package/dist/postgres/plan/rules.d.ts +3 -0
- package/dist/postgres/plan/rules.d.ts.map +1 -1
- package/dist/postgres/plan/schema.d.ts +3 -2
- package/dist/postgres/plan/schema.d.ts.map +1 -1
- package/dist/postgres/testing/fake-client.d.ts +6 -0
- package/dist/postgres/testing/fake-client.d.ts.map +1 -1
- package/dist/postgres/testing/roundtrip-schema.d.ts +4 -2
- package/dist/postgres/testing/roundtrip-schema.d.ts.map +1 -1
- package/dist/postgres.d.ts +1 -1
- package/dist/postgres.d.ts.map +1 -1
- package/dist/rules/postgres-names.ts +15 -2
- package/dist/rules/postgres-templates.ts +2 -2
- package/dist/rules/sql101.ts +1 -0
- package/dist/rules/sqlch001.ts +10 -3
- package/dist/rules/sqlpg001.ts +6 -21
- package/dist/rules/sqlpg113.ts +1 -1
- package/dist/rules/templates.ts +2 -2
- package/dist/validate.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/clickhouse/access.ts +197 -22
- package/src/clickhouse/apply/statements.ts +17 -5
- package/src/clickhouse/entities.ts +78 -2
- package/src/clickhouse/import/generator.ts +16 -3
- package/src/clickhouse/import/live-export.ts +17 -2
- package/src/clickhouse/live/catalog.ts +57 -10
- package/src/clickhouse/live/describe-resources.ts +3 -1
- package/src/clickhouse/live/kinds.e2e.test.ts +179 -0
- package/src/clickhouse/live/undeclarable.e2e.test.ts +65 -0
- package/src/clickhouse/live/undeclarable.ts +66 -0
- package/src/clickhouse/parser.test.ts +45 -2
- package/src/clickhouse/parser.ts +111 -3
- package/src/clickhouse/plan/deep.ts +25 -6
- package/src/clickhouse/plan/diff.ts +41 -1
- package/src/clickhouse/plan/normalize.ts +12 -4
- package/src/clickhouse/plan/rules.ts +22 -1
- package/src/clickhouse/quota-profile.test.ts +186 -0
- package/src/clickhouse/table-function.test.ts +54 -0
- package/src/clickhouse/testdata/server-ddl-baseline.json +17 -14
- package/src/clickhouse/testing/fake-server.ts +5 -0
- package/src/clickhouse/topology.ts +4 -2
- package/src/clickhouse.ts +6 -0
- package/src/codegen/classifier-page.test.ts +6 -0
- package/src/codegen/coverage-page.ts +77 -0
- package/src/codegen/docs.ts +5 -0
- package/src/codegen/postgres-classifier-page.ts +1 -1
- package/src/codegen/registry.ts +8 -0
- package/src/core/undeclarable.test.ts +141 -0
- package/src/core/undeclarable.ts +66 -0
- package/src/coverage/clickhouse-commands.json +24 -0
- package/src/coverage/clickhouse.json +25 -0
- package/src/coverage/postgres-commands.json +245 -0
- package/src/coverage/postgres.json +51 -0
- package/src/coverage.test.ts +78 -0
- package/src/coverage.ts +142 -0
- package/src/files/clickhouse.ts +20 -7
- package/src/files/common.ts +18 -0
- package/src/files/postgres.ts +25 -6
- package/src/generated/lexicon-sql.json +40 -0
- package/src/import-parser.ts +12 -4
- package/src/index.ts +2 -2
- package/src/lint/post-synth/postgres-names.ts +15 -2
- package/src/lint/post-synth/sql101.ts +1 -0
- package/src/lint/post-synth/sqlpg113.ts +1 -1
- package/src/lint/rules/postgres-templates.ts +2 -2
- package/src/lint/rules/sqlch001.ts +10 -3
- package/src/lint/rules/sqlpg001.ts +6 -21
- package/src/lint/rules/templates.ts +2 -2
- package/src/lsp/postgres-template.ts +14 -0
- package/src/mcp/index.ts +5 -5
- package/src/mcp/postgres.ts +1 -1
- package/src/plugin.ts +13 -2
- package/src/postgres/apply/apply.ts +8 -2
- package/src/postgres/apply/statements.ts +29 -6
- package/src/postgres/entities.test.ts +2 -2
- package/src/postgres/entities.ts +316 -28
- package/src/postgres/entity-types.ts +6 -0
- package/src/postgres/import/generator.ts +31 -4
- package/src/postgres/import/live-export.ts +25 -2
- package/src/postgres/kinds.test.ts +140 -0
- package/src/postgres/live/catalog-kinds.ts +312 -0
- package/src/postgres/live/catalog.ts +33 -11
- package/src/postgres/live/describe-resources.ts +14 -5
- package/src/postgres/live/kinds.e2e.test.ts +182 -0
- package/src/postgres/live/roundtrip.e2e.test.ts +9 -3
- package/src/postgres/live/undeclarable.e2e.test.ts +83 -0
- package/src/postgres/live/undeclarable.ts +141 -0
- package/src/postgres/parser.test.ts +2 -1
- package/src/postgres/parser.ts +307 -17
- package/src/postgres/plan/deep.ts +33 -0
- package/src/postgres/plan/diff.ts +45 -0
- package/src/postgres/plan/normalize.ts +153 -2
- package/src/postgres/plan/rules.ts +21 -0
- package/src/postgres/plan/schema.ts +6 -4
- package/src/postgres/testing/fake-client.ts +5 -0
- package/src/postgres/testing/roundtrip-schema.ts +19 -1
- package/src/postgres.ts +19 -0
- package/src/skill-defs.ts +1 -1
- package/src/skills/chant-sql-postgres.md +7 -3
- package/src/skills/chant-sql.md +3 -1
- package/src/unknown-clauses.test.ts +2 -1
- package/src/validate.ts +8 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `docs/pages/object-coverage.mdx`, written from the coverage tables
|
|
3
|
+
* (`../coverage/<dialect>.json`) by `npm run docs`, so the page cannot
|
|
4
|
+
* disagree with what import refuses.
|
|
5
|
+
*/
|
|
6
|
+
export declare function renderCoveragePage(): string;
|
|
7
|
+
//# sourceMappingURL=coverage-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-page.d.ts","sourceRoot":"","sources":["../../src/codegen/coverage-page.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4BH,wBAAgB,kBAAkB,IAAI,MAAM,CA4C3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/codegen/docs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuMH,wBAAsB,YAAY,CAAC,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/codegen/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/codegen/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0CH,wBAAgB,aAAa,IAAI,MAAM,CAKtC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Objects an import finds that no declaration can hold (#3911).
|
|
3
|
+
*
|
|
4
|
+
* Import reads every kind of object the server has, not only the kinds chant
|
|
5
|
+
* declares, so none is left out without a word. An object of a kind the
|
|
6
|
+
* coverage table marks refused (`../coverage.ts`) is collected here, and the
|
|
7
|
+
* import fails naming every one of them at once: kind, schema and name.
|
|
8
|
+
* `--skip-undeclarable` imports the rest and lists them as warnings instead,
|
|
9
|
+
* so an adopter is not stuck behind an aggregate they mean to keep by hand.
|
|
10
|
+
*/
|
|
11
|
+
import type { SqlDialect } from "../dialects.js";
|
|
12
|
+
/** One object of a kind chant cannot declare. */
|
|
13
|
+
export interface UndeclarableObject {
|
|
14
|
+
/** The coverage table's kind: `aggregate`, `composite type`. */
|
|
15
|
+
kind: string;
|
|
16
|
+
/** The Postgres schema or ClickHouse database it is in; absent for a database-wide or server-wide object. */
|
|
17
|
+
schema?: string;
|
|
18
|
+
/** Its name, with what identifies it besides: an aggregate's argument types, a rule's table, a cast's types. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** The role or user that owns it, where that tells a managed provider's own object from the database owner's. */
|
|
21
|
+
owner?: string;
|
|
22
|
+
}
|
|
23
|
+
/** `aggregate app.total(integer)`. */
|
|
24
|
+
export declare const describeUndeclarable: (o: UndeclarableObject) => string;
|
|
25
|
+
/** The import's refusal: every undeclarable object, then why for each kind among them. */
|
|
26
|
+
export declare class UndeclarableObjectsError extends Error {
|
|
27
|
+
readonly dialect: SqlDialect;
|
|
28
|
+
readonly objects: readonly UndeclarableObject[];
|
|
29
|
+
constructor(dialect: SqlDialect, objects: readonly UndeclarableObject[]);
|
|
30
|
+
}
|
|
31
|
+
/** One warning per object, for `--skip-undeclarable`. */
|
|
32
|
+
export declare function undeclarableWarnings(dialect: SqlDialect, objects: readonly UndeclarableObject[]): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Refuse the import when it found undeclarable objects, or, with `skip`,
|
|
35
|
+
* add a warning per object to `warnings`. Nothing found is nothing to do.
|
|
36
|
+
*/
|
|
37
|
+
export declare function refuseUndeclarable(dialect: SqlDialect, objects: readonly UndeclarableObject[], skip: boolean | undefined, warnings: string[]): void;
|
|
38
|
+
//# sourceMappingURL=undeclarable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undeclarable.d.ts","sourceRoot":"","sources":["../../src/core/undeclarable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,6GAA6G;IAC7G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gHAAgH;IAChH,IAAI,EAAE,MAAM,CAAC;IACb,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,sCAAsC;AACtC,eAAO,MAAM,oBAAoB,GAAI,GAAG,kBAAkB,KAAG,MAAgE,CAAC;AAI9H,0FAA0F;AAC1F,qBAAa,wBAAyB,SAAQ,KAAK;IAE/C,QAAQ,CAAC,OAAO,EAAE,UAAU;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE;gBADtC,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,SAAS,kBAAkB,EAAE;CAelD;AAED,yDAAyD;AACzD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,kBAAkB,EAAE,GAAG,MAAM,EAAE,CAE1G;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,kBAAkB,EAAE,EAAE,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAInJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "src/Parsers/ParserCreate*.h and src/Parsers/Access/ParserCreate*.h, at the pinned release's tag",
|
|
3
|
+
"version": "26.8.15.10",
|
|
4
|
+
"tag": "v26.8.15.10-lts",
|
|
5
|
+
"commands": [
|
|
6
|
+
"CREATE DATABASE",
|
|
7
|
+
"CREATE DICTIONARY",
|
|
8
|
+
"CREATE FUNCTION",
|
|
9
|
+
"CREATE HANDLER",
|
|
10
|
+
"CREATE INDEX",
|
|
11
|
+
"CREATE MASKING POLICY",
|
|
12
|
+
"CREATE NAMED COLLECTION",
|
|
13
|
+
"CREATE QUOTA",
|
|
14
|
+
"CREATE RESOURCE",
|
|
15
|
+
"CREATE ROLE",
|
|
16
|
+
"CREATE ROW POLICY",
|
|
17
|
+
"CREATE SETTINGS PROFILE",
|
|
18
|
+
"CREATE TABLE",
|
|
19
|
+
"CREATE USER",
|
|
20
|
+
"CREATE VIEW",
|
|
21
|
+
"CREATE WINDOW VIEW",
|
|
22
|
+
"CREATE WORKLOAD"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dialect": "clickhouse",
|
|
3
|
+
"kinds": [
|
|
4
|
+
{ "command": "CREATE DATABASE", "kind": "database", "status": "declared", "entity": "ClickHouse::Database" },
|
|
5
|
+
{ "command": "CREATE DICTIONARY", "kind": "dictionary", "status": "declared", "entity": "ClickHouse::Dictionary" },
|
|
6
|
+
{ "command": "CREATE FUNCTION", "kind": "SQL function", "status": "declared", "entity": "ClickHouse::Function" },
|
|
7
|
+
{ "command": "CREATE FUNCTION", "form": "LANGUAGE WASM, or with a driver", "match": "\\bLANGUAGE\\b|\\bUSING\\s+DRIVER\\b", "kind": "non-SQL function", "status": "refused", "reason": "only a SQL function (CREATE FUNCTION f AS (x) -> ...) is declared" },
|
|
8
|
+
{ "command": "CREATE HANDLER", "kind": "HTTP handler", "status": "refused", "reason": "an HTTP handler is server-level configuration, not a schema object" },
|
|
9
|
+
{ "command": "CREATE INDEX", "kind": "index", "status": "declared", "entity": "ClickHouse::Table", "note": "an index is part of its table: SHOW CREATE TABLE prints it, and the table's declaration holds it" },
|
|
10
|
+
{ "command": "CREATE MASKING POLICY", "kind": "masking policy", "status": "refused", "reason": "masking policies are available only in ClickHouse Cloud, not on the pinned server" },
|
|
11
|
+
{ "command": "CREATE NAMED COLLECTION", "kind": "named collection", "status": "refused", "reason": "a named collection holds credentials (a password, a secret key), which are the environment's and never in a build; the server hides its values, so a plan could not compare them either" },
|
|
12
|
+
{ "command": "CREATE QUOTA", "kind": "quota", "status": "declared", "entity": "ClickHouse::Quota", "note": "import reads only the access objects a build declares" },
|
|
13
|
+
{ "command": "CREATE RESOURCE", "kind": "workload resource", "status": "refused", "reason": "a resource is server-level scheduling (a disk's reads or writes), configured with the server, not a schema object" },
|
|
14
|
+
{ "command": "CREATE ROLE", "kind": "role", "status": "declared", "entity": "ClickHouse::Role", "note": "import reads only the access objects a build declares" },
|
|
15
|
+
{ "command": "CREATE ROW POLICY", "kind": "row policy", "status": "declared", "entity": "ClickHouse::RowPolicy", "note": "import reads only the access objects a build declares" },
|
|
16
|
+
{ "command": "CREATE SETTINGS PROFILE", "kind": "settings profile", "status": "declared", "entity": "ClickHouse::SettingsProfile", "note": "import reads only the access objects a build declares" },
|
|
17
|
+
{ "command": "CREATE TABLE", "kind": "table", "status": "declared", "entity": "ClickHouse::Table" },
|
|
18
|
+
{ "command": "CREATE TABLE", "form": "TEMPORARY", "match": "^CREATE\\s+TEMPORARY\\b", "kind": "temporary table", "status": "out-of-scope", "reason": "a temporary table lives in one session" },
|
|
19
|
+
{ "command": "CREATE USER", "kind": "user", "status": "declared", "entity": "ClickHouse::User", "note": "import reads only the access objects a build declares" },
|
|
20
|
+
{ "command": "CREATE VIEW", "kind": "view", "status": "declared", "entity": "ClickHouse::View" },
|
|
21
|
+
{ "command": "CREATE VIEW", "form": "MATERIALIZED", "match": "^CREATE\\s+(?:OR\\s+REPLACE\\s+)?MATERIALIZED\\b", "kind": "materialized view", "status": "declared", "entity": "ClickHouse::MaterializedView" },
|
|
22
|
+
{ "command": "CREATE WINDOW VIEW", "kind": "window view", "status": "refused", "reason": "a window view is experimental, and the pinned server refuses it under its default query analyzer" },
|
|
23
|
+
{ "command": "CREATE WORKLOAD", "kind": "workload", "status": "refused", "reason": "a workload is server-level scheduling, configured with the server, not a schema object" }
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
{
|
|
2
|
+
"source": "doc/src/sgml/ref/create_*.sgml <refname>, at each pinned major's tag",
|
|
3
|
+
"majors": {
|
|
4
|
+
"14": {
|
|
5
|
+
"version": "14.24",
|
|
6
|
+
"tag": "REL_14_24",
|
|
7
|
+
"commands": [
|
|
8
|
+
"CREATE ACCESS METHOD",
|
|
9
|
+
"CREATE AGGREGATE",
|
|
10
|
+
"CREATE CAST",
|
|
11
|
+
"CREATE COLLATION",
|
|
12
|
+
"CREATE CONVERSION",
|
|
13
|
+
"CREATE DATABASE",
|
|
14
|
+
"CREATE DOMAIN",
|
|
15
|
+
"CREATE EVENT TRIGGER",
|
|
16
|
+
"CREATE EXTENSION",
|
|
17
|
+
"CREATE FOREIGN DATA WRAPPER",
|
|
18
|
+
"CREATE FOREIGN TABLE",
|
|
19
|
+
"CREATE FUNCTION",
|
|
20
|
+
"CREATE GROUP",
|
|
21
|
+
"CREATE INDEX",
|
|
22
|
+
"CREATE LANGUAGE",
|
|
23
|
+
"CREATE MATERIALIZED VIEW",
|
|
24
|
+
"CREATE OPERATOR",
|
|
25
|
+
"CREATE OPERATOR CLASS",
|
|
26
|
+
"CREATE OPERATOR FAMILY",
|
|
27
|
+
"CREATE POLICY",
|
|
28
|
+
"CREATE PROCEDURE",
|
|
29
|
+
"CREATE PUBLICATION",
|
|
30
|
+
"CREATE ROLE",
|
|
31
|
+
"CREATE RULE",
|
|
32
|
+
"CREATE SCHEMA",
|
|
33
|
+
"CREATE SEQUENCE",
|
|
34
|
+
"CREATE SERVER",
|
|
35
|
+
"CREATE STATISTICS",
|
|
36
|
+
"CREATE SUBSCRIPTION",
|
|
37
|
+
"CREATE TABLE",
|
|
38
|
+
"CREATE TABLE AS",
|
|
39
|
+
"CREATE TABLESPACE",
|
|
40
|
+
"CREATE TEXT SEARCH CONFIGURATION",
|
|
41
|
+
"CREATE TEXT SEARCH DICTIONARY",
|
|
42
|
+
"CREATE TEXT SEARCH PARSER",
|
|
43
|
+
"CREATE TEXT SEARCH TEMPLATE",
|
|
44
|
+
"CREATE TRANSFORM",
|
|
45
|
+
"CREATE TRIGGER",
|
|
46
|
+
"CREATE TYPE",
|
|
47
|
+
"CREATE USER",
|
|
48
|
+
"CREATE USER MAPPING",
|
|
49
|
+
"CREATE VIEW"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"15": {
|
|
53
|
+
"version": "15.19",
|
|
54
|
+
"tag": "REL_15_19",
|
|
55
|
+
"commands": [
|
|
56
|
+
"CREATE ACCESS METHOD",
|
|
57
|
+
"CREATE AGGREGATE",
|
|
58
|
+
"CREATE CAST",
|
|
59
|
+
"CREATE COLLATION",
|
|
60
|
+
"CREATE CONVERSION",
|
|
61
|
+
"CREATE DATABASE",
|
|
62
|
+
"CREATE DOMAIN",
|
|
63
|
+
"CREATE EVENT TRIGGER",
|
|
64
|
+
"CREATE EXTENSION",
|
|
65
|
+
"CREATE FOREIGN DATA WRAPPER",
|
|
66
|
+
"CREATE FOREIGN TABLE",
|
|
67
|
+
"CREATE FUNCTION",
|
|
68
|
+
"CREATE GROUP",
|
|
69
|
+
"CREATE INDEX",
|
|
70
|
+
"CREATE LANGUAGE",
|
|
71
|
+
"CREATE MATERIALIZED VIEW",
|
|
72
|
+
"CREATE OPERATOR",
|
|
73
|
+
"CREATE OPERATOR CLASS",
|
|
74
|
+
"CREATE OPERATOR FAMILY",
|
|
75
|
+
"CREATE POLICY",
|
|
76
|
+
"CREATE PROCEDURE",
|
|
77
|
+
"CREATE PUBLICATION",
|
|
78
|
+
"CREATE ROLE",
|
|
79
|
+
"CREATE RULE",
|
|
80
|
+
"CREATE SCHEMA",
|
|
81
|
+
"CREATE SEQUENCE",
|
|
82
|
+
"CREATE SERVER",
|
|
83
|
+
"CREATE STATISTICS",
|
|
84
|
+
"CREATE SUBSCRIPTION",
|
|
85
|
+
"CREATE TABLE",
|
|
86
|
+
"CREATE TABLE AS",
|
|
87
|
+
"CREATE TABLESPACE",
|
|
88
|
+
"CREATE TEXT SEARCH CONFIGURATION",
|
|
89
|
+
"CREATE TEXT SEARCH DICTIONARY",
|
|
90
|
+
"CREATE TEXT SEARCH PARSER",
|
|
91
|
+
"CREATE TEXT SEARCH TEMPLATE",
|
|
92
|
+
"CREATE TRANSFORM",
|
|
93
|
+
"CREATE TRIGGER",
|
|
94
|
+
"CREATE TYPE",
|
|
95
|
+
"CREATE USER",
|
|
96
|
+
"CREATE USER MAPPING",
|
|
97
|
+
"CREATE VIEW"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"16": {
|
|
101
|
+
"version": "16.15",
|
|
102
|
+
"tag": "REL_16_15",
|
|
103
|
+
"commands": [
|
|
104
|
+
"CREATE ACCESS METHOD",
|
|
105
|
+
"CREATE AGGREGATE",
|
|
106
|
+
"CREATE CAST",
|
|
107
|
+
"CREATE COLLATION",
|
|
108
|
+
"CREATE CONVERSION",
|
|
109
|
+
"CREATE DATABASE",
|
|
110
|
+
"CREATE DOMAIN",
|
|
111
|
+
"CREATE EVENT TRIGGER",
|
|
112
|
+
"CREATE EXTENSION",
|
|
113
|
+
"CREATE FOREIGN DATA WRAPPER",
|
|
114
|
+
"CREATE FOREIGN TABLE",
|
|
115
|
+
"CREATE FUNCTION",
|
|
116
|
+
"CREATE GROUP",
|
|
117
|
+
"CREATE INDEX",
|
|
118
|
+
"CREATE LANGUAGE",
|
|
119
|
+
"CREATE MATERIALIZED VIEW",
|
|
120
|
+
"CREATE OPERATOR",
|
|
121
|
+
"CREATE OPERATOR CLASS",
|
|
122
|
+
"CREATE OPERATOR FAMILY",
|
|
123
|
+
"CREATE POLICY",
|
|
124
|
+
"CREATE PROCEDURE",
|
|
125
|
+
"CREATE PUBLICATION",
|
|
126
|
+
"CREATE ROLE",
|
|
127
|
+
"CREATE RULE",
|
|
128
|
+
"CREATE SCHEMA",
|
|
129
|
+
"CREATE SEQUENCE",
|
|
130
|
+
"CREATE SERVER",
|
|
131
|
+
"CREATE STATISTICS",
|
|
132
|
+
"CREATE SUBSCRIPTION",
|
|
133
|
+
"CREATE TABLE",
|
|
134
|
+
"CREATE TABLE AS",
|
|
135
|
+
"CREATE TABLESPACE",
|
|
136
|
+
"CREATE TEXT SEARCH CONFIGURATION",
|
|
137
|
+
"CREATE TEXT SEARCH DICTIONARY",
|
|
138
|
+
"CREATE TEXT SEARCH PARSER",
|
|
139
|
+
"CREATE TEXT SEARCH TEMPLATE",
|
|
140
|
+
"CREATE TRANSFORM",
|
|
141
|
+
"CREATE TRIGGER",
|
|
142
|
+
"CREATE TYPE",
|
|
143
|
+
"CREATE USER",
|
|
144
|
+
"CREATE USER MAPPING",
|
|
145
|
+
"CREATE VIEW"
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"17": {
|
|
149
|
+
"version": "17.11",
|
|
150
|
+
"tag": "REL_17_11",
|
|
151
|
+
"commands": [
|
|
152
|
+
"CREATE ACCESS METHOD",
|
|
153
|
+
"CREATE AGGREGATE",
|
|
154
|
+
"CREATE CAST",
|
|
155
|
+
"CREATE COLLATION",
|
|
156
|
+
"CREATE CONVERSION",
|
|
157
|
+
"CREATE DATABASE",
|
|
158
|
+
"CREATE DOMAIN",
|
|
159
|
+
"CREATE EVENT TRIGGER",
|
|
160
|
+
"CREATE EXTENSION",
|
|
161
|
+
"CREATE FOREIGN DATA WRAPPER",
|
|
162
|
+
"CREATE FOREIGN TABLE",
|
|
163
|
+
"CREATE FUNCTION",
|
|
164
|
+
"CREATE GROUP",
|
|
165
|
+
"CREATE INDEX",
|
|
166
|
+
"CREATE LANGUAGE",
|
|
167
|
+
"CREATE MATERIALIZED VIEW",
|
|
168
|
+
"CREATE OPERATOR",
|
|
169
|
+
"CREATE OPERATOR CLASS",
|
|
170
|
+
"CREATE OPERATOR FAMILY",
|
|
171
|
+
"CREATE POLICY",
|
|
172
|
+
"CREATE PROCEDURE",
|
|
173
|
+
"CREATE PUBLICATION",
|
|
174
|
+
"CREATE ROLE",
|
|
175
|
+
"CREATE RULE",
|
|
176
|
+
"CREATE SCHEMA",
|
|
177
|
+
"CREATE SEQUENCE",
|
|
178
|
+
"CREATE SERVER",
|
|
179
|
+
"CREATE STATISTICS",
|
|
180
|
+
"CREATE SUBSCRIPTION",
|
|
181
|
+
"CREATE TABLE",
|
|
182
|
+
"CREATE TABLE AS",
|
|
183
|
+
"CREATE TABLESPACE",
|
|
184
|
+
"CREATE TEXT SEARCH CONFIGURATION",
|
|
185
|
+
"CREATE TEXT SEARCH DICTIONARY",
|
|
186
|
+
"CREATE TEXT SEARCH PARSER",
|
|
187
|
+
"CREATE TEXT SEARCH TEMPLATE",
|
|
188
|
+
"CREATE TRANSFORM",
|
|
189
|
+
"CREATE TRIGGER",
|
|
190
|
+
"CREATE TYPE",
|
|
191
|
+
"CREATE USER",
|
|
192
|
+
"CREATE USER MAPPING",
|
|
193
|
+
"CREATE VIEW"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"18": {
|
|
197
|
+
"version": "18.6",
|
|
198
|
+
"tag": "REL_18_6",
|
|
199
|
+
"commands": [
|
|
200
|
+
"CREATE ACCESS METHOD",
|
|
201
|
+
"CREATE AGGREGATE",
|
|
202
|
+
"CREATE CAST",
|
|
203
|
+
"CREATE COLLATION",
|
|
204
|
+
"CREATE CONVERSION",
|
|
205
|
+
"CREATE DATABASE",
|
|
206
|
+
"CREATE DOMAIN",
|
|
207
|
+
"CREATE EVENT TRIGGER",
|
|
208
|
+
"CREATE EXTENSION",
|
|
209
|
+
"CREATE FOREIGN DATA WRAPPER",
|
|
210
|
+
"CREATE FOREIGN TABLE",
|
|
211
|
+
"CREATE FUNCTION",
|
|
212
|
+
"CREATE GROUP",
|
|
213
|
+
"CREATE INDEX",
|
|
214
|
+
"CREATE LANGUAGE",
|
|
215
|
+
"CREATE MATERIALIZED VIEW",
|
|
216
|
+
"CREATE OPERATOR",
|
|
217
|
+
"CREATE OPERATOR CLASS",
|
|
218
|
+
"CREATE OPERATOR FAMILY",
|
|
219
|
+
"CREATE POLICY",
|
|
220
|
+
"CREATE PROCEDURE",
|
|
221
|
+
"CREATE PUBLICATION",
|
|
222
|
+
"CREATE ROLE",
|
|
223
|
+
"CREATE RULE",
|
|
224
|
+
"CREATE SCHEMA",
|
|
225
|
+
"CREATE SEQUENCE",
|
|
226
|
+
"CREATE SERVER",
|
|
227
|
+
"CREATE STATISTICS",
|
|
228
|
+
"CREATE SUBSCRIPTION",
|
|
229
|
+
"CREATE TABLE",
|
|
230
|
+
"CREATE TABLE AS",
|
|
231
|
+
"CREATE TABLESPACE",
|
|
232
|
+
"CREATE TEXT SEARCH CONFIGURATION",
|
|
233
|
+
"CREATE TEXT SEARCH DICTIONARY",
|
|
234
|
+
"CREATE TEXT SEARCH PARSER",
|
|
235
|
+
"CREATE TEXT SEARCH TEMPLATE",
|
|
236
|
+
"CREATE TRANSFORM",
|
|
237
|
+
"CREATE TRIGGER",
|
|
238
|
+
"CREATE TYPE",
|
|
239
|
+
"CREATE USER",
|
|
240
|
+
"CREATE USER MAPPING",
|
|
241
|
+
"CREATE VIEW"
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dialect": "postgres",
|
|
3
|
+
"kinds": [
|
|
4
|
+
{ "command": "CREATE ACCESS METHOD", "kind": "access method", "status": "refused", "reason": "no tag declares an access method; an extension usually installs one, and the extension is declared instead" },
|
|
5
|
+
{ "command": "CREATE AGGREGATE", "kind": "aggregate", "status": "declared", "entity": "Postgres::Aggregate" },
|
|
6
|
+
{ "command": "CREATE CAST", "kind": "cast", "status": "declared", "entity": "Postgres::Cast", "note": "the database's, named by its two types; read where a type or its function is in scope" },
|
|
7
|
+
{ "command": "CREATE COLLATION", "kind": "collation", "status": "declared", "entity": "Postgres::Collation" },
|
|
8
|
+
{ "command": "CREATE CONVERSION", "kind": "conversion", "status": "refused", "reason": "no tag declares an encoding conversion" },
|
|
9
|
+
{ "command": "CREATE DATABASE", "kind": "database", "status": "out-of-scope", "reason": "a project's schema lives in one database, which the environment provides (sql.profiles.<env>)" },
|
|
10
|
+
{ "command": "CREATE DOMAIN", "kind": "domain", "status": "declared", "entity": "Postgres::Domain" },
|
|
11
|
+
{ "command": "CREATE EVENT TRIGGER", "kind": "event trigger", "status": "declared", "entity": "Postgres::EventTrigger", "note": "the database's, not a schema's; creating one takes a superuser" },
|
|
12
|
+
{ "command": "CREATE EXTENSION", "kind": "extension", "status": "declared", "entity": "Postgres::Extension" },
|
|
13
|
+
{ "command": "CREATE FOREIGN DATA WRAPPER", "kind": "foreign data wrapper", "status": "refused", "reason": "no tag declares a foreign data wrapper yet; one an extension installs comes with the extension" },
|
|
14
|
+
{ "command": "CREATE FOREIGN TABLE", "kind": "foreign table", "status": "refused", "reason": "no tag declares a foreign table yet" },
|
|
15
|
+
{ "command": "CREATE FUNCTION", "kind": "function", "status": "declared", "entity": "Postgres::Function" },
|
|
16
|
+
{ "command": "CREATE FUNCTION", "form": "RETURN or BEGIN ATOMIC body", "match": "\\b(?:RETURN|BEGIN\\s+ATOMIC)\\b", "kind": "routine with a SQL-standard body", "status": "refused", "reason": "the server stores a SQL-standard body parsed and prints it back rewritten, so a declaration cannot be compared with it; declare the routine with a string body (AS $$ ... $$)" },
|
|
17
|
+
{ "command": "CREATE GROUP", "kind": "group", "status": "declared", "entity": "Postgres::Role", "note": "an alias of CREATE ROLE" },
|
|
18
|
+
{ "command": "CREATE INDEX", "kind": "index", "status": "declared", "entity": "Postgres::Index" },
|
|
19
|
+
{ "command": "CREATE LANGUAGE", "kind": "procedural language", "status": "refused", "reason": "no tag declares a procedural language; an extension installs one, and the extension is declared instead" },
|
|
20
|
+
{ "command": "CREATE MATERIALIZED VIEW", "kind": "materialized view", "status": "declared", "entity": "Postgres::MaterializedView" },
|
|
21
|
+
{ "command": "CREATE OPERATOR", "kind": "operator", "status": "refused", "reason": "no tag declares an operator yet" },
|
|
22
|
+
{ "command": "CREATE OPERATOR CLASS", "kind": "operator class", "status": "refused", "reason": "no tag declares an operator class yet" },
|
|
23
|
+
{ "command": "CREATE OPERATOR FAMILY", "kind": "operator family", "status": "refused", "reason": "no tag declares an operator family yet" },
|
|
24
|
+
{ "command": "CREATE POLICY", "kind": "policy", "status": "declared", "entity": "Postgres::Policy", "note": "read where the profile manages access (sql.profiles.<env>.access)" },
|
|
25
|
+
{ "command": "CREATE PROCEDURE", "kind": "procedure", "status": "declared", "entity": "Postgres::Procedure" },
|
|
26
|
+
{ "command": "CREATE PUBLICATION", "kind": "publication", "status": "refused", "reason": "no tag declares a publication yet" },
|
|
27
|
+
{ "command": "CREATE ROLE", "kind": "role", "status": "declared", "entity": "Postgres::Role", "note": "import reads only the roles a build declares, since a role is the cluster's" },
|
|
28
|
+
{ "command": "CREATE RULE", "kind": "rule", "status": "refused", "reason": "no tag declares a rewrite rule; a view's own rule is the view's" },
|
|
29
|
+
{ "command": "CREATE SCHEMA", "kind": "schema", "status": "declared", "entity": "Postgres::Schema" },
|
|
30
|
+
{ "command": "CREATE SEQUENCE", "kind": "sequence", "status": "declared", "entity": "Postgres::Sequence" },
|
|
31
|
+
{ "command": "CREATE SERVER", "kind": "foreign server", "status": "refused", "reason": "no tag declares a foreign server yet" },
|
|
32
|
+
{ "command": "CREATE STATISTICS", "kind": "extended statistics", "status": "refused", "reason": "no tag declares extended statistics yet" },
|
|
33
|
+
{ "command": "CREATE SUBSCRIPTION", "kind": "subscription", "status": "refused", "reason": "no tag declares a subscription yet" },
|
|
34
|
+
{ "command": "CREATE TABLE", "kind": "table", "status": "declared", "entity": "Postgres::Table" },
|
|
35
|
+
{ "command": "CREATE TABLE AS", "kind": "table from a query", "status": "declared", "entity": "Postgres::Table", "note": "the server keeps no query, so the table it made reads as a CREATE TABLE" },
|
|
36
|
+
{ "command": "CREATE TABLESPACE", "kind": "tablespace", "status": "out-of-scope", "reason": "a tablespace is the cluster's, a directory on the server; a table's TABLESPACE clause is kept" },
|
|
37
|
+
{ "command": "CREATE TEXT SEARCH CONFIGURATION", "kind": "text search configuration", "status": "refused", "reason": "no tag declares a text search configuration yet" },
|
|
38
|
+
{ "command": "CREATE TEXT SEARCH DICTIONARY", "kind": "text search dictionary", "status": "refused", "reason": "no tag declares a text search dictionary yet" },
|
|
39
|
+
{ "command": "CREATE TEXT SEARCH PARSER", "kind": "text search parser", "status": "refused", "reason": "no tag declares a text search parser; one is C code an extension installs" },
|
|
40
|
+
{ "command": "CREATE TEXT SEARCH TEMPLATE", "kind": "text search template", "status": "refused", "reason": "no tag declares a text search template; one is C code an extension installs" },
|
|
41
|
+
{ "command": "CREATE TRANSFORM", "kind": "transform", "status": "refused", "reason": "no tag declares a transform; an extension installs one" },
|
|
42
|
+
{ "command": "CREATE TRIGGER", "kind": "trigger", "status": "declared", "entity": "Postgres::Trigger" },
|
|
43
|
+
{ "command": "CREATE TYPE", "form": "AS ENUM", "match": "\\bAS\\s+ENUM\\b", "kind": "enum type", "status": "declared", "entity": "Postgres::Enum" },
|
|
44
|
+
{ "command": "CREATE TYPE", "form": "AS (...)", "match": "\\bAS\\s*\\(", "kind": "composite type", "status": "declared", "entity": "Postgres::CompositeType" },
|
|
45
|
+
{ "command": "CREATE TYPE", "form": "AS RANGE", "match": "\\bAS\\s+RANGE\\b", "kind": "range type", "status": "declared", "entity": "Postgres::RangeType", "note": "its multirange type comes with it (MULTIRANGE_TYPE_NAME)" },
|
|
46
|
+
{ "command": "CREATE TYPE", "form": "INPUT, OUTPUT, or a shell type", "kind": "base type", "status": "refused", "reason": "no tag declares a base type; its input and output functions are C code an extension installs" },
|
|
47
|
+
{ "command": "CREATE USER", "kind": "user", "status": "declared", "entity": "Postgres::Role", "note": "an alias of CREATE ROLE ... LOGIN" },
|
|
48
|
+
{ "command": "CREATE USER MAPPING", "kind": "user mapping", "status": "refused", "reason": "no tag declares a user mapping yet" },
|
|
49
|
+
{ "command": "CREATE VIEW", "kind": "view", "status": "declared", "entity": "Postgres::View" }
|
|
50
|
+
]
|
|
51
|
+
}
|
package/dist/coverage.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Coverage, two ways.
|
|
3
|
+
*
|
|
4
|
+
* Which kinds of object each dialect declares (#3911): every `CREATE` command
|
|
5
|
+
* a pinned server has (`./coverage/<dialect>-commands.json`, written by
|
|
6
|
+
* `scripts/sql-create-commands.ts` from the server's own sources) has a row
|
|
7
|
+
* in `./coverage/<dialect>.json` marking it declared, refused with a reason,
|
|
8
|
+
* or out of scope. A command with several forms that differ in what chant can
|
|
9
|
+
* hold (`CREATE TYPE ... AS ENUM` and `CREATE TYPE ... AS RANGE`) has a row
|
|
10
|
+
* per form. Import refuses an object of a refused kind by that row's `kind`
|
|
11
|
+
* (`./core/undeclarable.ts`), and the docs page is rendered from the rows
|
|
12
|
+
* (`./codegen/coverage-page.ts`). To declare a kind, flip its row to
|
|
13
|
+
* `declared` with the `entity` that holds it, and drop the reason.
|
|
14
|
+
*
|
|
2
15
|
* How much of the pinned ClickHouse catalog the dialect types beyond its name.
|
|
3
16
|
*
|
|
4
17
|
* Every engine, type family, codec, skip index type and setting at the pin is
|
|
@@ -7,6 +20,61 @@
|
|
|
7
20
|
* checked, one whose arguments are `unknown` can only be named. This reports
|
|
8
21
|
* that, per section, from the generated tables.
|
|
9
22
|
*/
|
|
23
|
+
import type { SqlDialect } from "./dialects.js";
|
|
24
|
+
/** `declared`: a tag holds it. `refused`: import names it and stops. `out-of-scope`: the environment's, never imported. */
|
|
25
|
+
export type KindStatus = "declared" | "refused" | "out-of-scope";
|
|
26
|
+
/** One row of a dialect's coverage table: a `CREATE` command, or one form of it. */
|
|
27
|
+
export interface KindRow {
|
|
28
|
+
/** The command as the server's reference names it: `CREATE TYPE`. */
|
|
29
|
+
command: string;
|
|
30
|
+
/** The form of the command the row is about, when the command has forms chant treats apart: `AS RANGE`. */
|
|
31
|
+
form?: string;
|
|
32
|
+
/**
|
|
33
|
+
* How a statement of the command is told to be this form: a regular
|
|
34
|
+
* expression, case-insensitive, over the statement with its comments and
|
|
35
|
+
* string literals taken out. The command's row without one is the rest.
|
|
36
|
+
*/
|
|
37
|
+
match?: string;
|
|
38
|
+
/** The object kind, unique in the dialect, as messages name it: `range type`. */
|
|
39
|
+
kind: string;
|
|
40
|
+
status: KindStatus;
|
|
41
|
+
/** The entity type that declares it, when declared. */
|
|
42
|
+
entity?: string;
|
|
43
|
+
/** Why it is refused or out of scope. */
|
|
44
|
+
reason?: string;
|
|
45
|
+
/** Anything else a reader should know. */
|
|
46
|
+
note?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Each dialect's coverage table. */
|
|
49
|
+
export declare const KIND_COVERAGE: Record<SqlDialect, readonly KindRow[]>;
|
|
50
|
+
/** The `CREATE` commands each pinned server has: per Postgres major, and the pinned ClickHouse release. */
|
|
51
|
+
export declare const PINNED_COMMANDS: Record<SqlDialect, ReadonlyArray<{
|
|
52
|
+
version: string;
|
|
53
|
+
commands: readonly string[];
|
|
54
|
+
}>>;
|
|
55
|
+
/** A dialect's row for `kind`; throws for a kind the table does not have, so a probe cannot name one that is not there. */
|
|
56
|
+
export declare function kindRow(dialect: SqlDialect, kind: string): KindRow;
|
|
57
|
+
/**
|
|
58
|
+
* What is wrong with a dialect's coverage table, against its pinned servers'
|
|
59
|
+
* commands: a command a pinned server has and no row covers, a row for a
|
|
60
|
+
* command no pinned server has, a kind named twice, a declared row with no
|
|
61
|
+
* entity, a refused or out-of-scope row with no reason. Empty when complete.
|
|
62
|
+
*/
|
|
63
|
+
export declare function kindCoverageProblems(dialect: SqlDialect, opts?: {
|
|
64
|
+
pins?: ReadonlyArray<{
|
|
65
|
+
version: string;
|
|
66
|
+
commands: readonly string[];
|
|
67
|
+
}>;
|
|
68
|
+
rows?: readonly KindRow[];
|
|
69
|
+
}): string[];
|
|
70
|
+
/**
|
|
71
|
+
* The coverage row a `CREATE` statement is of, by its command (the longest
|
|
72
|
+
* that its words start with) and, among the command's forms, the first whose
|
|
73
|
+
* `match` it matches; undefined for a statement no row covers.
|
|
74
|
+
*/
|
|
75
|
+
export declare function statementKind(dialect: SqlDialect, sql: string): KindRow | undefined;
|
|
76
|
+
/** Whether the commands file was written for the pinned servers: a list for each pinned version, and for no other. */
|
|
77
|
+
export declare function pinnedCommandsCurrent(dialect: SqlDialect): string[];
|
|
10
78
|
export interface CoverageSection {
|
|
11
79
|
section: string;
|
|
12
80
|
total: number;
|
package/dist/coverage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../src/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ7C,2HAA2H;AAC3H,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;AAEjE,oFAAoF;AACpF,MAAM,WAAW,OAAO;IACtB,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qCAAqC;AACrC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,OAAO,EAAE,CAGhE,CAAC;AAEF,2GAA2G;AAC3G,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC,CAG/G,CAAC;AAEF,2HAA2H;AAC3H,wBAAgB,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAIlE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;CAAO,GAAG,MAAM,EAAE,CAmBpL;AAiBD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAcnF;AAED,sHAAsH;AACtH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,CAQnE;AAID,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,wBAAgB,OAAO,IAAI,cAAc,CAyBxC;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,IAAI,CAYjH"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* A file of ClickHouse DDL as the objects it declares: one per `CREATE
|
|
3
3
|
* DATABASE`, `TABLE`, `VIEW`, `MATERIALIZED VIEW`, `DICTIONARY` or `FUNCTION`, as `chant import
|
|
4
4
|
* <file>.sql` reads them, and one per `CREATE USER`, `CREATE ROLE`, `CREATE
|
|
5
|
-
* ROW POLICY`
|
|
5
|
+
* ROW POLICY`, `CREATE QUOTA`, `CREATE SETTINGS PROFILE` (#3911) and `GRANT`
|
|
6
|
+
* (#3711), each read by its tag, so what the tag
|
|
6
7
|
* refuses (`IDENTIFIED BY`, a `REVOKE`) is refused with the tag's message.
|
|
7
8
|
* Any other statement, and any statement the parser refuses, is a problem
|
|
8
9
|
* naming it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clickhouse.d.ts","sourceRoot":"","sources":["../../src/files/clickhouse.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"clickhouse.d.ts","sourceRoot":"","sources":["../../src/files/clickhouse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAO9D,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAA8F,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvJ,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;AA2D/E,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAG3D;AAED,sHAAsH;AACtH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,cAAc,GAAG,QAAQ,CAAC,CAwCtH"}
|
package/dist/files/common.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** What reading a file of DDL shares across dialects. */
|
|
2
2
|
import type { Token } from "../core/tokens.js";
|
|
3
3
|
import type { UnknownClause } from "../core/cursor.js";
|
|
4
|
+
import type { SqlDialect } from "../dialects.js";
|
|
4
5
|
export interface ReadOptions {
|
|
5
6
|
/** Names the DDL in errors: a file's path, a command. */
|
|
6
7
|
origin: string;
|
|
@@ -9,7 +10,18 @@ export interface ReadOptions {
|
|
|
9
10
|
* unqualified, as an ORM does when the schema comes from its connection.
|
|
10
11
|
*/
|
|
11
12
|
schema?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Where a statement of a kind chant cannot declare goes (#3911), as a line
|
|
15
|
+
* naming it, instead of among the problems: `chant import
|
|
16
|
+
* --parser-option skipUndeclarable` lists them as warnings.
|
|
17
|
+
*/
|
|
18
|
+
undeclarable?: string[];
|
|
12
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* A `CREATE` of a kind the coverage table does not mark declared, as the line
|
|
22
|
+
* that names it with why, or undefined for any other statement.
|
|
23
|
+
*/
|
|
24
|
+
export declare function undeclarableStatement(dialect: SqlDialect, sql: string): string | undefined;
|
|
13
25
|
/** A file of DDL with statements that declare nothing chant can hold: each problem names its statement. */
|
|
14
26
|
export declare class SqlFileError extends Error {
|
|
15
27
|
readonly origin: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/files/common.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/files/common.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAEzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI1F;AAED,2GAA2G;AAC3G,qBAAa,YAAa,SAAQ,KAAK;IAEnC,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE;gBAD3B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,SAAS,MAAM,EAAE;CAOvC;AAED,sHAAsH;AACtH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,OAAO,GAAG,KAAK,EAAE,EAAE,CAiBhG;AAED,eAAO,MAAM,UAAU,GAAI,QAAQ,SAAS,KAAK,EAAE,KAAG,MAA4C,CAAC;AAEnG,yGAAyG;AACzG,MAAM,WAAW,QAAQ;IACvB,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yGAAyG;IACzG,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,kIAAkI;AAClI,wBAAgB,YAAY,CAC1B,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,SAAS,EAC7C,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,QAAQ,CAAC,UAAU,CAAC,CAGtB;AAED,0DAA0D;AAC1D,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,EAAE,IAAI,MAAM,KAAG,MAA8C,CAAC;AAEjG,+CAA+C;AAC/C,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,MAAgD,CAAC;AAEvF,6FAA6F;AAC7F,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAAoF,CAAC"}
|
package/dist/files/postgres.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* With `schema`, the names the DDL leaves unqualified are qualified with it,
|
|
17
17
|
* as an ORM's connection would: an object's own name, an index's, trigger's
|
|
18
18
|
* or policy's table, a foreign key's table, a comment's target, and a column
|
|
19
|
-
* type naming an enum or domain the file creates.
|
|
19
|
+
* type naming an enum, composite, range or domain type the file creates.
|
|
20
20
|
*/
|
|
21
21
|
import type { Declarable } from "@intentius/chant/declarable";
|
|
22
22
|
import type { ImportedPgObject } from "../postgres/import/ir.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/files/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAM9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../src/files/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAM9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAA8F,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvJ,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,UAAU,CAAC;AAE/E,4CAA4C;AAC5C,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAGzD;AAED,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,oBAAoB,CAE9E;AAKD,8EAA8E;AAC9E,8EAA8E;AAC9E,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAAqF,CAAC;AAsB5H;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,gBAAgB,GAAG,QAAQ,CAAC,CAgJtH"}
|
package/dist/import-parser.d.ts
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* anything else is ClickHouse.
|
|
10
10
|
*
|
|
11
11
|
* A statement that declares nothing, or does not parse, is an error naming
|
|
12
|
-
* it (`./sql-files.ts`); none is left out.
|
|
12
|
+
* it (`./sql-files.ts`); none is left out. So is a `CREATE` of a kind chant
|
|
13
|
+
* cannot declare (#3911, `./coverage.ts`): `--parser-option
|
|
14
|
+
* skipUndeclarable` imports the rest and lists those as warnings. A clause the parser does not know
|
|
13
15
|
* (#3872) is kept in the template as written.
|
|
14
16
|
*/
|
|
15
17
|
import type { ParserOptions, TemplateIR, TemplateParser } from "@intentius/chant/import/parser";
|
|
@@ -20,7 +22,10 @@ export declare function guessDialect(content: string): SqlDialect;
|
|
|
20
22
|
export declare function dialectOption(options: ParserOptions | undefined): SqlDialect | undefined;
|
|
21
23
|
export declare class SqlFileParser implements TemplateParser {
|
|
22
24
|
private readonly dialect?;
|
|
23
|
-
|
|
25
|
+
private readonly options;
|
|
26
|
+
constructor(dialect?: SqlDialect | undefined, options?: {
|
|
27
|
+
skipUndeclarable?: boolean;
|
|
28
|
+
});
|
|
24
29
|
parse(content: string): TemplateIR;
|
|
25
30
|
}
|
|
26
31
|
//# sourceMappingURL=import-parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-parser.d.ts","sourceRoot":"","sources":["../src/import-parser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"import-parser.d.ts","sourceRoot":"","sources":["../src/import-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAqB3D,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAKxD;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAKxF;AAED,qBAAa,aAAc,YAAW,cAAc;IAEhD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,OAAO,CAAC,EAAE,UAAU,YAAA,EACpB,OAAO,GAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAO;IAG/D,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;CAUnC"}
|