@lark-base-open/base-database-cli 1.1.1 → 1.3.8
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/CHANGELOG.md +97 -0
- package/LICENSE +6 -0
- package/README.md +47 -27
- package/dist/ai-functions.d.ts +53 -0
- package/dist/ai-functions.d.ts.map +1 -0
- package/dist/ai-functions.js +436 -0
- package/dist/ai-functions.js.map +1 -0
- package/dist/archive.d.ts +21 -0
- package/dist/archive.d.ts.map +1 -1
- package/dist/archive.js +69 -10
- package/dist/archive.js.map +1 -1
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +26 -3
- package/dist/auth.js.map +1 -1
- package/dist/check.d.ts +74 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +283 -0
- package/dist/check.js.map +1 -0
- package/dist/dependency-policy.d.ts +10 -0
- package/dist/dependency-policy.d.ts.map +1 -0
- package/dist/dependency-policy.js +162 -0
- package/dist/dependency-policy.js.map +1 -0
- package/dist/deploy.d.ts +5 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +141 -176
- package/dist/deploy.js.map +1 -1
- package/dist/environment-variables.d.ts +52 -0
- package/dist/environment-variables.d.ts.map +1 -0
- package/dist/environment-variables.js +563 -0
- package/dist/environment-variables.js.map +1 -0
- package/dist/environment.d.ts +1 -1
- package/dist/environment.js +1 -1
- package/dist/environment.js.map +1 -1
- package/dist/function-input-types.d.ts +10 -0
- package/dist/function-input-types.d.ts.map +1 -0
- package/dist/function-input-types.js +160 -0
- package/dist/function-input-types.js.map +1 -0
- package/dist/function-schema.d.ts.map +1 -1
- package/dist/function-schema.js +89 -36
- package/dist/function-schema.js.map +1 -1
- package/dist/init-field-retry.d.ts +17 -0
- package/dist/init-field-retry.d.ts.map +1 -0
- package/dist/init-field-retry.js +127 -0
- package/dist/init-field-retry.js.map +1 -0
- package/dist/init-journal.d.ts +98 -0
- package/dist/init-journal.d.ts.map +1 -0
- package/dist/init-journal.js +492 -0
- package/dist/init-journal.js.map +1 -0
- package/dist/init-schema.d.ts +8 -0
- package/dist/init-schema.d.ts.map +1 -0
- package/dist/init-schema.js +423 -0
- package/dist/init-schema.js.map +1 -0
- package/dist/init.d.ts +15 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +884 -261
- package/dist/init.js.map +1 -1
- package/dist/lark-cli-error.d.ts +47 -0
- package/dist/lark-cli-error.d.ts.map +1 -0
- package/dist/lark-cli-error.js +201 -0
- package/dist/lark-cli-error.js.map +1 -0
- package/dist/lark-cli.d.ts +1 -1
- package/dist/lark-cli.d.ts.map +1 -1
- package/dist/lark-cli.js +78 -18
- package/dist/lark-cli.js.map +1 -1
- package/dist/mutation-schema.d.ts +146 -0
- package/dist/mutation-schema.d.ts.map +1 -0
- package/dist/mutation-schema.js +153 -0
- package/dist/mutation-schema.js.map +1 -0
- package/dist/mutation.d.ts +10 -0
- package/dist/mutation.d.ts.map +1 -0
- package/dist/mutation.js +131 -0
- package/dist/mutation.js.map +1 -0
- package/dist/npm.d.ts +1 -0
- package/dist/npm.d.ts.map +1 -1
- package/dist/npm.js +2 -2
- package/dist/npm.js.map +1 -1
- package/dist/preview-receipt.d.ts.map +1 -1
- package/dist/preview-receipt.js +15 -5
- package/dist/preview-receipt.js.map +1 -1
- package/dist/process.d.ts +3 -1
- package/dist/process.d.ts.map +1 -1
- package/dist/process.js +16 -4
- package/dist/process.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +246 -42
- package/dist/program.js.map +1 -1
- package/dist/project-build.d.ts +25 -0
- package/dist/project-build.d.ts.map +1 -0
- package/dist/project-build.js +229 -0
- package/dist/project-build.js.map +1 -0
- package/dist/project-context.d.ts +344 -0
- package/dist/project-context.d.ts.map +1 -0
- package/dist/project-context.js +485 -0
- package/dist/project-context.js.map +1 -0
- package/dist/project-layout.d.ts +5 -0
- package/dist/project-layout.d.ts.map +1 -0
- package/dist/project-layout.js +24 -0
- package/dist/project-layout.js.map +1 -0
- package/dist/public-sql-error.d.ts +25 -0
- package/dist/public-sql-error.d.ts.map +1 -0
- package/dist/public-sql-error.js +65 -0
- package/dist/public-sql-error.js.map +1 -0
- package/dist/pull.d.ts +1 -0
- package/dist/pull.d.ts.map +1 -1
- package/dist/pull.js +67 -15
- package/dist/pull.js.map +1 -1
- package/dist/site-readme.d.ts +3 -0
- package/dist/site-readme.d.ts.map +1 -0
- package/dist/site-readme.js +83 -0
- package/dist/site-readme.js.map +1 -0
- package/dist/workspace-fingerprint.d.ts +21 -1
- package/dist/workspace-fingerprint.d.ts.map +1 -1
- package/dist/workspace-fingerprint.js +81 -2
- package/dist/workspace-fingerprint.js.map +1 -1
- package/package.json +2 -1
- package/skills/lark-base-database/SKILL.md +86 -52
- package/skills/lark-base-database/references/ai-function.md +479 -0
- package/skills/lark-base-database/references/base-capability-routing.md +7 -7
- package/skills/lark-base-database/references/base-sql-errors.generated.md +403 -0
- package/skills/lark-base-database/references/database-function-limitations.md +29 -0
- package/skills/lark-base-database/references/database-function.md +323 -0
- package/skills/lark-base-database/references/development.md +166 -33
- package/skills/lark-base-database/references/environment-variables.md +55 -0
- package/skills/lark-base-database/references/faas.md +46 -53
- package/skills/lark-base-database/references/file-transfer.md +25 -25
- package/skills/lark-base-database/references/frontend-design-guide.md +151 -65
- package/skills/lark-base-database/references/mutations.md +295 -0
- package/skills/lark-base-database/references/notifications.md +9 -9
- package/skills/lark-base-database/references/permission-design.md +24 -24
- package/skills/lark-base-database/references/release.md +57 -30
- package/skills/lark-base-database/references/style-guide.md +10 -67
- package/skills/lark-base-database/references/verification.md +19 -13
- package/skills/lark-base-database/references/workspace.md +57 -17
- package/templates/database-starter/README.md +34 -4
- package/templates/database-starter/database-functions/README.md +8 -0
- package/templates/database-starter/gitignore +7 -0
- package/templates/database-starter/mutations/README.md +19 -0
- package/templates/database-starter/page/README.md +25 -19
- package/templates/database-starter/page/package-lock.json +8 -16
- package/templates/database-starter/page/package.json +2 -3
- package/templates/database-starter/page/src/App.tsx +23 -3
- package/templates/database-starter/page/src/components/UserSelectorEditor/index.tsx +32 -4
- package/templates/database-starter/page/src/components/UserSelectorPanel/index.tsx +104 -34
- package/templates/database-starter/page/src/components/UserSelectorPanel/user-search.test.ts +55 -11
- package/templates/database-starter/page/src/components/UserSelectorPanel/user-search.ts +68 -25
- package/templates/database-starter/page/src/components/database-runtime-ready.tsx +1 -1
- package/templates/database-starter/page/src/components/database-user-menu/index.tsx +4 -7
- package/templates/database-starter/page/src/components/feedback/page-state.tsx +40 -5
- package/templates/database-starter/page/src/components/floating-button/assets/edit-active.svg +3 -0
- package/templates/database-starter/page/src/components/floating-button/assets/edit-default.svg +3 -0
- package/templates/database-starter/page/src/components/floating-button/assets/toast-close.svg +3 -0
- package/templates/database-starter/page/src/components/floating-button/assets/toast-info.svg +5 -0
- package/templates/database-starter/page/src/components/floating-button/assets/tooltip-caret.svg +3 -0
- package/templates/database-starter/page/src/components/floating-button/index.tsx +193 -113
- package/templates/database-starter/page/src/components/floating-button/utils/project-meta.test.ts +107 -37
- package/templates/database-starter/page/src/components/floating-button/utils/project-meta.ts +13 -50
- package/templates/database-starter/page/src/components/ui-language.test.tsx +101 -0
- package/templates/database-starter/page/src/examples/ai-function/ImageTaskOperation.tsx +202 -0
- package/templates/database-starter/page/src/examples/ai-function/README.md +14 -0
- package/templates/database-starter/page/src/examples/ai-function/TextStreamOperation.tsx +184 -0
- package/templates/database-starter/page/src/examples/ai-function/ai-copy.ts +173 -0
- package/templates/database-starter/page/src/examples/ai-function/ai-delta.test.ts +30 -0
- package/templates/database-starter/page/src/examples/ai-function/ai-delta.ts +26 -0
- package/templates/database-starter/page/src/examples/ai-function/ai-language.test.tsx +86 -0
- package/templates/database-starter/page/src/examples/ai-function/ai-media-panel.test.ts +201 -0
- package/templates/database-starter/page/src/examples/ai-function/ai-media-panel.tsx +382 -0
- package/templates/database-starter/page/src/lib/attachment-image.tsx +144 -0
- package/templates/database-starter/page/src/lib/database-function-inputs.generated.ts +4 -0
- package/templates/database-starter/page/src/lib/database-runtime-attachment.test.ts +180 -76
- package/templates/database-starter/page/src/lib/database-runtime.test.ts +130 -10
- package/templates/database-starter/page/src/lib/database-runtime.ts +484 -51
- package/templates/database-starter/page/src/lib/date-time.ts +61 -0
- package/templates/database-starter/page/src/lib/ui-language.ts +86 -0
- package/templates/database-starter/page/src/main.tsx +1 -1
- package/templates/database-starter/page/tsconfig.json +2 -2
- package/templates/database-starter/page/vite.config.ts +1 -2
- package/templates/database-starter/prettierignore +1 -1
- package/templates/database-starter/server-functions/README.md +2 -2
- package/templates/database-starter/server-functions/package-lock.json +4 -4
- package/templates/database-starter/server-functions/package.json +1 -1
- package/dist/agent-guide.d.ts +0 -19
- package/dist/agent-guide.d.ts.map +0 -1
- package/dist/agent-guide.js +0 -31
- package/dist/agent-guide.js.map +0 -1
- package/dist/database-skill.d.ts +0 -24
- package/dist/database-skill.d.ts.map +0 -1
- package/dist/database-skill.js +0 -148
- package/dist/database-skill.js.map +0 -1
- package/skills/lark-base-database/references/base-sql-unsupported.md +0 -42
- package/skills/lark-base-database/references/database-capability-skill.md +0 -40
- package/skills/lark-base-database/references/sql-function.md +0 -289
- package/templates/database-capability/SKILL.md.tmpl +0 -58
- package/templates/database-starter/page/src/components/floating-button/chatbot-entry.test.ts +0 -23
- package/templates/database-starter/page/src/components/floating-button/chatbot-entry.tsx +0 -873
- package/templates/database-starter/page/src/components/floating-button/local-chat-panel.test.ts +0 -25
- package/templates/database-starter/page/src/components/floating-button/local-chat-panel.tsx +0 -197
- package/templates/database-starter/page/src/components/floating-button/utils/env.ts +0 -18
- package/templates/database-starter/sql/README.md +0 -8
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
<!-- Generated by errorcatalog-gen; do not edit. -->
|
|
2
|
+
# Unsupported SQL and alternatives
|
|
3
|
+
|
|
4
|
+
Use names and types from catalog.json. Refresh the Catalog when the schema changes. Follow every precondition below; a guard intentionally changes error behavior. Outside-SQL policies use the following guidance: Compute it in the code that consumes the query result (in Base Site: a Page or an Edge Function).
|
|
5
|
+
|
|
6
|
+
## Verified SQL forms
|
|
7
|
+
|
|
8
|
+
### Division with a zero divisor
|
|
9
|
+
|
|
10
|
+
Use NULLIF(divisor, 0) as the divisor if a NULL result is acceptable.
|
|
11
|
+
|
|
12
|
+
Preconditions: The caller accepts NULL instead of a division-by-zero error.
|
|
13
|
+
|
|
14
|
+
Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
|
|
15
|
+
|
|
16
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
17
|
+
|
|
18
|
+
```sql
|
|
19
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, 1::bigint / NULLIF(0::bigint, 0::bigint) AS value FROM source ORDER BY id;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Division with a nonzero divisor
|
|
23
|
+
|
|
24
|
+
Use NULLIF(divisor, 0) as the divisor if a NULL result is acceptable.
|
|
25
|
+
|
|
26
|
+
Preconditions: For a nonzero divisor the value must be unchanged.
|
|
27
|
+
|
|
28
|
+
Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
|
|
29
|
+
|
|
30
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
31
|
+
|
|
32
|
+
```sql
|
|
33
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, 7::bigint / NULLIF(2::bigint, 0::bigint) AS value FROM source ORDER BY id;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Filter a window output in a subquery
|
|
37
|
+
|
|
38
|
+
Compute the window in a SELECT subquery, then refer to its output.
|
|
39
|
+
|
|
40
|
+
Preconditions: Move the window output into a subquery before filtering; this corrects an invalid window context.
|
|
41
|
+
|
|
42
|
+
Validation kind: `author`. Error code: `SQL_WINDOW_NOT_ALLOWED`.
|
|
43
|
+
|
|
44
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
45
|
+
|
|
46
|
+
```sql
|
|
47
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders), ranked AS (SELECT id, ROW_NUMBER() OVER (ORDER BY sort_key, id) AS rn FROM source) SELECT id FROM ranked WHERE rn = 1 ORDER BY id;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Use the PostgreSQL TO_CHAR spelling
|
|
51
|
+
|
|
52
|
+
Use the stated public SQL function and its documented signature.
|
|
53
|
+
|
|
54
|
+
Preconditions: Choose the intended PostgreSQL format; this example uses the full date and time format.
|
|
55
|
+
|
|
56
|
+
Validation kind: `author`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
|
|
57
|
+
|
|
58
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
59
|
+
|
|
60
|
+
```sql
|
|
61
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, TO_CHAR(TIMESTAMP '2026-09-26 12:34:56', 'YYYY-MM-DD HH24:MI:SS') AS value FROM source ORDER BY id;
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Give NULL an explicit public type
|
|
65
|
+
|
|
66
|
+
Use an explicit CAST with the intended public SQL type.
|
|
67
|
+
|
|
68
|
+
Preconditions: Choose the intended public type; the example chooses TEXT.
|
|
69
|
+
|
|
70
|
+
Validation kind: `author`. Error code: `SQL_UNTYPED_NULL`.
|
|
71
|
+
|
|
72
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
73
|
+
|
|
74
|
+
```sql
|
|
75
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, CAST(NULL AS TEXT) AS value FROM source ORDER BY id;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Correlated max join
|
|
79
|
+
|
|
80
|
+
For an equality comparison to a grouped MAX, aggregate by the correlation key in a subquery and JOIN that result. Preserve NULL and empty-group behavior. Other correlated forms have no verified SQL rewrite.
|
|
81
|
+
|
|
82
|
+
Preconditions: Equality to a correlated MAX grouped by the correlation key; preserve NULL keys and empty groups.
|
|
83
|
+
|
|
84
|
+
Validation kind: `equivalent`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
|
|
85
|
+
|
|
86
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
87
|
+
|
|
88
|
+
```sql
|
|
89
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT s.id, s.value FROM source s JOIN (SELECT group_key AS k, MAX(value) AS m FROM source GROUP BY group_key) g ON s.group_key = g.k WHERE s.value = g.m ORDER BY s.id;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Octet length bytes
|
|
93
|
+
|
|
94
|
+
STRLEN is not supported. For byte counts, use OCTET_LENGTH(text). Byte counts and character counts can differ; character counting has no verified SQL equivalent.
|
|
95
|
+
|
|
96
|
+
Preconditions: The intent is byte count, not character count. The fixture includes non-ASCII text and NULL values.
|
|
97
|
+
|
|
98
|
+
Validation kind: `equivalent`. Error code: `SQL_FUNCTION_NOT_FOUND`.
|
|
99
|
+
|
|
100
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
101
|
+
|
|
102
|
+
```sql
|
|
103
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, OCTET_LENGTH(text_value) AS value FROM source ORDER BY id;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Array scalar containment
|
|
107
|
+
|
|
108
|
+
Both operands must be arrays of compatible element types. For single-value containment, wrap the scalar in a one-element array.
|
|
109
|
+
|
|
110
|
+
Preconditions: Single-value array containment is intended; include NULL input and unmatched elements.
|
|
111
|
+
|
|
112
|
+
Validation kind: `equivalent`. Error code: `SQL_OPERATOR_TYPE_MISMATCH`.
|
|
113
|
+
|
|
114
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
115
|
+
|
|
116
|
+
```sql
|
|
117
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, ARRAY[group_key] <@ ARRAY['g1','g2'] AS value FROM source ORDER BY id;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Array scalar contains
|
|
121
|
+
|
|
122
|
+
Both operands must be arrays of compatible element types. For single-value containment, wrap the scalar in a one-element array.
|
|
123
|
+
|
|
124
|
+
Preconditions: Single-value array containment is intended; include NULL input and unmatched elements.
|
|
125
|
+
|
|
126
|
+
Validation kind: `equivalent`. Error code: `SQL_OPERATOR_TYPE_MISMATCH`.
|
|
127
|
+
|
|
128
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
129
|
+
|
|
130
|
+
```sql
|
|
131
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, ARRAY['g1','g2'] @> ARRAY[group_key] AS value FROM source ORDER BY id;
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Numeric predicate
|
|
135
|
+
|
|
136
|
+
Use a BOOL condition. If the intent is to exclude zero, compare the numeric expression with zero; NULL rows will not match.
|
|
137
|
+
|
|
138
|
+
Preconditions: The explicitly selected intent is to exclude numeric zero and NULL.
|
|
139
|
+
|
|
140
|
+
Validation kind: `author`. Error code: `SQL_WHERE_TYPE_MISMATCH`.
|
|
141
|
+
|
|
142
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
143
|
+
|
|
144
|
+
```sql
|
|
145
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id FROM source WHERE value <> 0 ORDER BY id;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Text predicate
|
|
149
|
+
|
|
150
|
+
Use a BOOL condition. If the intent is to exclude empty text, compare the text expression with an empty string; NULL rows will not match.
|
|
151
|
+
|
|
152
|
+
Preconditions: The explicitly selected intent is to exclude empty text and NULL.
|
|
153
|
+
|
|
154
|
+
Validation kind: `author`. Error code: `SQL_WHERE_TYPE_MISMATCH`.
|
|
155
|
+
|
|
156
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
157
|
+
|
|
158
|
+
```sql
|
|
159
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id FROM source WHERE text_value <> '' ORDER BY id;
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Remainder nullif
|
|
163
|
+
|
|
164
|
+
Use NULLIF(divisor, 0) as the remainder divisor if a NULL result is acceptable.
|
|
165
|
+
|
|
166
|
+
Preconditions: Returning NULL instead of an error for a zero remainder divisor is acceptable.
|
|
167
|
+
|
|
168
|
+
Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
|
|
169
|
+
|
|
170
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
171
|
+
|
|
172
|
+
```sql
|
|
173
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, CAST(sort_key AS BIGINT) % NULLIF(CAST(0 AS BIGINT), CAST(0 AS BIGINT)) AS value FROM source ORDER BY id;
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Remainder nullif nonzero
|
|
177
|
+
|
|
178
|
+
Use NULLIF(divisor, 0) as the remainder divisor if a NULL result is acceptable.
|
|
179
|
+
|
|
180
|
+
Preconditions: Integer-valued sort keys; verify that the guard preserves a nonzero divisor.
|
|
181
|
+
|
|
182
|
+
Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
|
|
183
|
+
|
|
184
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
185
|
+
|
|
186
|
+
```sql
|
|
187
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id, CAST(sort_key AS BIGINT) % NULLIF(CAST(2 AS BIGINT), CAST(0 AS BIGINT)) AS value FROM source ORDER BY id;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Cast int format
|
|
191
|
+
|
|
192
|
+
Use an optional sign and decimal digits for INT input, for example '123'. Supply the intended value; do not substitute the example.
|
|
193
|
+
|
|
194
|
+
Preconditions: The caller explicitly supplies the value 123; this example must not replace an unknown intended value.
|
|
195
|
+
|
|
196
|
+
Validation kind: `author`. Error code: `SQL_INVALID_CAST`.
|
|
197
|
+
|
|
198
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
199
|
+
|
|
200
|
+
```sql
|
|
201
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT CAST('123' AS INT) AS value FROM source LIMIT 1;
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Cast double format
|
|
205
|
+
|
|
206
|
+
Use a finite decimal number for DOUBLE input, for example '1.25'. Supply the intended value; do not substitute the example.
|
|
207
|
+
|
|
208
|
+
Preconditions: The caller explicitly supplies the finite decimal value 1.25.
|
|
209
|
+
|
|
210
|
+
Validation kind: `author`. Error code: `SQL_INVALID_CAST`.
|
|
211
|
+
|
|
212
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
213
|
+
|
|
214
|
+
```sql
|
|
215
|
+
WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT CAST('1.25' AS DOUBLE PRECISION) AS value FROM source LIMIT 1;
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Materialize option names before array construction
|
|
219
|
+
|
|
220
|
+
Compute OPTION.name in a derived table first, then construct ARRAY from that projected column. Preserve the original joins, filters, and NULL behavior.
|
|
221
|
+
|
|
222
|
+
Preconditions: Project OPTION.name before constructing the array. This case preserves an INNER JOIN with condition TRUE, NULL values, duplicates and row count; retain other original predicates.
|
|
223
|
+
|
|
224
|
+
Validation kind: `equivalent`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
|
|
225
|
+
|
|
226
|
+
The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
|
|
227
|
+
|
|
228
|
+
```sql
|
|
229
|
+
SELECT q.id, v AS value FROM (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) q CROSS JOIN UNNEST(ARRAY[q.text_value]) v ORDER BY q.id;
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Unsupported diagnostics
|
|
233
|
+
|
|
234
|
+
Placeholders denote the names and types reported in the error. Use the concrete restriction reported in the error; placeholders do not declare every possible value unsupported.
|
|
235
|
+
|
|
236
|
+
| Code / variant | Reason | Repair |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| `SQL_CAST_TYPE_MISMATCH` / `unsupported_conversion` | Conversion from {SourceType} to {TargetType} is not supported. | Choose a column or parameter already having the required type. An equivalent conversion has not been verified. [outside_sql] |
|
|
239
|
+
| `SQL_FUNCTION_NOT_FOUND` / `known_unavailable` | Function {Function} is not supported. | {Alternative} [outside_sql] |
|
|
240
|
+
| `SQL_FUNCTION_NOT_FOUND` / `unsupported_function` | Function {Function} is not supported. | [outside_sql] |
|
|
241
|
+
| `SQL_INTERVAL_LITERAL_CALENDAR_UNIT_NOT_SUPPORTED` / `interval_calendar_unit` | Calendar interval unit {Unit} is not supported. | A fixed day count is not equivalent. [outside_sql] |
|
|
242
|
+
| `SQL_INTERVAL_LITERAL_FRACTIONAL_MILLISECONDS` / `interval_precision` | The interval must be an exact whole number of milliseconds. | Whole milliseconds are supported; higher precision cannot be preserved by rounding. [outside_sql] |
|
|
243
|
+
| `SQL_INTERVAL_LITERAL_UNIT_NOT_SUPPORTED` / `interval_unit` | Interval unit {Unit} is not supported. | Use day, hour, minute, second, or millisecond units. |
|
|
244
|
+
| `SQL_UNSUPPORTED_COLUMN_TYPE` / `column_representation` | Column {Column} has type {BaseType}; {Representation}. | A supported column is required for an equivalent SQL operation. [outside_sql] |
|
|
245
|
+
| `SQL_UNSUPPORTED_OPERATOR` / `unavailable_operation` | This {Operation} is not supported. | [outside_sql] |
|
|
246
|
+
| `SQL_UNSUPPORTED_OPERATOR` / `unsupported_field_operator` | Column {Column} has type {ActualType}, which does not support {Operator}. | [outside_sql] |
|
|
247
|
+
| `SQL_UNSUPPORTED_OPERATOR` / `unsupported_operator` | Operator {Operator} is not supported for {ArgTypes}. | [outside_sql] |
|
|
248
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `aggregate_modifier` | Aggregate {Function} does not support {Modifier}. | [outside_sql] |
|
|
249
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `aggregate_separator` | The separator of {Function} must be {Requirement}. | [outside_sql] |
|
|
250
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `array_dimension` | ARRAY_LENGTH dimension must be {Form}. | Changing the dimension can change the result. [outside_sql] |
|
|
251
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `array_subquery_shape` | This ARRAY subquery shape is not supported. | Only a direct single-column UNNEST projection is supported here. [outside_sql] |
|
|
252
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `binary_operator` | Unsupported binary operator: {Operator}. | [outside_sql] |
|
|
253
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `capability_budget` | The supported limit was exceeded: {Dimension}. | Reduce this query dimension or split the operation into separate queries. |
|
|
254
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `correlated_exists` | Correlated EXISTS does not support {Predicate}. | Only supported equality correlations can be expressed in SQL. [outside_sql] |
|
|
255
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `correlated_option_array` | Correlated OPTION.name expressions inside ARRAY require a materialized input. | Compute OPTION.name in a derived table first, then construct ARRAY from that projected column. Preserve the original joins, filters, and NULL behavior. |
|
|
256
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `date_trunc_context` | DATE_TRUNC output cannot be used in {Context}. | [outside_sql] |
|
|
257
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `date_trunc_unit` | DATE_TRUNC unit {Part} is not supported because it cannot preserve timestamp identity. | [outside_sql] |
|
|
258
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `function_input_types` | Function {Function} requires TEXT arguments; received {ArgTypes}. | Use TEXT inputs for this function. |
|
|
259
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `identity_operation` | Unsupported operation: {Constraint}. | Compare identities of the same kind or use separate TEXT parameters; do not transform identity values. |
|
|
260
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `identity_output` | Output {Output} combines identities with incompatible values. | Keep USER identities, CHAT identities, and plain text in separate outputs. |
|
|
261
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `identity_parameter` | Parameter {Parameter} violates this constraint: {Constraint}. | Use separate TEXT parameters for each identity namespace and for plain text. |
|
|
262
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `location_coordinate` | LOCATION member {Member} is not supported. | An address or complete object is not an equivalent result. [outside_sql] |
|
|
263
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `named_window_reference` | Window definition {Window} is missing or duplicated. | Use a unique WINDOW definition and reference its declared name. |
|
|
264
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `nested_cte` | A nested CTE is not supported in {Context}. | [outside_sql] |
|
|
265
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `null_ordering` | Explicit NULLS ordering requires {Constraint}. | [outside_sql] |
|
|
266
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `option_member_context` | OPTION[].name cannot be used in {Context}. | An equivalent SQL rewrite preserving row multiplicity has not been verified. [outside_sql] |
|
|
267
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `protocol_shape` | Invalid compiled structure: {Shape} is not supported. | Recompile the query using the current supported contract. |
|
|
268
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `route_table_required` | The query must reference a table for execution routing. | Adding an arbitrary table can change row count. [outside_sql] |
|
|
269
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `subquery_constraint` | {Construct} requires {Constraint}. | The subquery must satisfy the stated constraint for a supported SQL rewrite. [outside_sql] |
|
|
270
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `syntax_feature` | SQL feature {Feature} is not supported. | [outside_sql] |
|
|
271
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `syntax_restriction` | {Restriction}. | [outside_sql] |
|
|
272
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `type_representation` | The query cannot represent type {ActualType}. | [outside_sql] |
|
|
273
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `unary_operator` | Unsupported unary operator: {Operator}. | [outside_sql] |
|
|
274
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `unavailable_function_syntax` | Function {Function} is not supported. | [outside_sql] |
|
|
275
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `window_capability` | Window function {Function} requires {Requirement}. | [outside_sql] |
|
|
276
|
+
| `SQL_UNSUPPORTED_SYNTAX_DISTINCT_FROM` / `distinct_comparison` | IS DISTINCT FROM and IS NOT DISTINCT FROM are not supported. | [outside_sql] |
|
|
277
|
+
| `SQL_UNSUPPORTED_SYNTAX_EXCEPT` / `except_set` | EXCEPT {Quantifier} is not supported. | Duplicate and NULL behavior must be preserved. [outside_sql] |
|
|
278
|
+
| `SQL_UNSUPPORTED_SYNTAX_INTERSECT` / `intersect_set` | INTERSECT {Quantifier} is not supported. | Duplicate and NULL behavior must be preserved. [outside_sql] |
|
|
279
|
+
| `SQL_UNSUPPORTED_SYNTAX_LAG_LEAD` / `lag_lead_argument` | Argument {Argument} of {Function} has an unsupported form; expected {Form}. | Argument {Argument} requires {Form}. [outside_sql] |
|
|
280
|
+
| `SQL_UNSUPPORTED_SYNTAX_LATERAL` / `lateral_correlation` | LATERAL with {Correlation} is not supported. | [outside_sql] |
|
|
281
|
+
| `SQL_UNSUPPORTED_SYNTAX_NULL_IN_LIST` / `null_in_list` | An explicit NULL element in an IN or NOT IN list is not supported. | Removing NULL can change the result. [outside_sql] |
|
|
282
|
+
| `SQL_UNSUPPORTED_SYNTAX_RECURSIVE_CTE` / `recursive_cte` | Recursive CTE {CTE} is not supported. | [outside_sql] |
|
|
283
|
+
| `SQL_UNSUPPORTED_SYNTAX_REGEXP_REPLACE` / `regexp_replacement` | The requested replacement mode is not supported: {Mode}. | [outside_sql] |
|
|
284
|
+
| `SQL_UNSUPPORTED_SYNTAX_WINDOW_FRAME` / `window_frame` | The window specification is not supported: {Frame}. | Changing the frame can change the result. [outside_sql] |
|
|
285
|
+
|
|
286
|
+
## Syntax restriction repair policies
|
|
287
|
+
|
|
288
|
+
| Restriction | Policy | Reason | Repair |
|
|
289
|
+
|---|---|---|---|
|
|
290
|
+
| `AggregateCallForm` | `outside_sql` | This aggregate FILTER, ORDER BY, WITHIN GROUP, or variadic call form is not supported | [outside_sql] |
|
|
291
|
+
| `AggregateFilter` | `outside_sql` | FILTER requires an aggregate function | [outside_sql] |
|
|
292
|
+
| `AnyKeyType` | `outside_sql` | Expanded ANY arrays require numeric or TEXT operands | [outside_sql] |
|
|
293
|
+
| `ArrayConstructor` | `outside_sql` | This ANY operand requires an ARRAY constructor | [outside_sql] |
|
|
294
|
+
| `ArrayDimension` | `outside_sql` | ARRAY_LENGTH requires literal 1 as the dimension | [outside_sql] |
|
|
295
|
+
| `ArrayLengthArity` | `outside_sql` | Use ARRAY_LENGTH(array, 1) or CARDINALITY(array) | [outside_sql] |
|
|
296
|
+
| `ArraySubquery` | `outside_sql` | ANY array operands and elements cannot contain subqueries | [outside_sql] |
|
|
297
|
+
| `ArrayTypeModifier` | `outside_sql` | An empty ANY array requires an unmodified supported scalar array type | [outside_sql] |
|
|
298
|
+
| `BetweenBounds` | `outside_sql` | BETWEEN requires two bounds | [outside_sql] |
|
|
299
|
+
| `BooleanOperands` | `outside_sql` | A boolean expression requires operands | [outside_sql] |
|
|
300
|
+
| `BooleanOperator` | `outside_sql` | This boolean operator is not supported | [outside_sql] |
|
|
301
|
+
| `CTESearchCycle` | `outside_sql` | CTE SEARCH and CYCLE are not supported | [outside_sql] |
|
|
302
|
+
| `CaseBranch` | `outside_sql` | A CASE WHEN branch is invalid | [outside_sql] |
|
|
303
|
+
| `CastModifier` | `outside_sql` | Cast targets with modifiers or explicit array bounds are not supported | [outside_sql] |
|
|
304
|
+
| `CastTargetMissing` | `outside_sql` | CAST requires a target type | [outside_sql] |
|
|
305
|
+
| `CastValueMissing` | `outside_sql` | CAST requires a value | [outside_sql] |
|
|
306
|
+
| `ColumnAlias` | `outside_sql` | Column aliases must be non-empty identifiers | [outside_sql] |
|
|
307
|
+
| `ColumnQualification` | `outside_sql` | A column reference may have at most a table alias and a column name; use (column).field for object members | [outside_sql] |
|
|
308
|
+
| `ColumnReference` | `outside_sql` | This column reference form is not supported | [outside_sql] |
|
|
309
|
+
| `ConstantMembership` | `outside_sql` | Constant membership requires literal SELECT or UNION leaves and literal boolean filters, without ordering or pagination | [outside_sql] |
|
|
310
|
+
| `ConstantMembershipKey` | `outside_sql` | This constant membership key has no supported equivalent rewrite | [outside_sql] |
|
|
311
|
+
| `CorrelatedMembership` | `outside_sql` | Correlated membership requires equality column predicates between one inner source and current outer sources | [outside_sql] |
|
|
312
|
+
| `CorrelatedScalar` | `conditional_pattern` | Correlated scalar subqueries are not supported; aggregate the inner source and JOIN the grouped result | For an equality comparison to a grouped MAX, aggregate by the correlation key in a subquery and JOIN that result. Preserve NULL and empty-group behavior. Other correlated forms have no verified SQL rewrite. |
|
|
313
|
+
| `CurrentDate` | `outside_sql` | CURRENT_DATE is not supported; use a TIMESTAMP value or CURRENT_TIMESTAMP when equivalent | [outside_sql] |
|
|
314
|
+
| `DistinctGrouping` | `outside_sql` | GROUP BY DISTINCT grouping sets require one source, unambiguous field keys, and an aggregate for the empty grouping set | [outside_sql] |
|
|
315
|
+
| `DistinctOnNullOrdering` | `outside_sql` | DISTINCT ON with explicit NULLS ordering is not supported | [outside_sql] |
|
|
316
|
+
| `DistinctOnPrefix` | `outside_sql` | DISTINCT ON expressions must match the leftmost ORDER BY expressions | [outside_sql] |
|
|
317
|
+
| `DistinctWithGroupingSets` | `outside_sql` | SELECT DISTINCT with GROUPING SETS is not supported | [outside_sql] |
|
|
318
|
+
| `EmptyProjection` | `outside_sql` | SELECT must produce at least one column | [outside_sql] |
|
|
319
|
+
| `EqualityAny` | `outside_sql` | Array ANY supports equality comparisons only | [outside_sql] |
|
|
320
|
+
| `ExpressionForm` | `outside_sql` | This expression form is not supported | [outside_sql] |
|
|
321
|
+
| `ExpressionList` | `outside_sql` | An expression list cannot be empty | [outside_sql] |
|
|
322
|
+
| `ExpressionOperator` | `outside_sql` | This expression operator is not supported | [outside_sql] |
|
|
323
|
+
| `ExtractForm` | `outside_sql` | Use EXTRACT(field FROM expression) | [outside_sql] |
|
|
324
|
+
| `ExtremaOperator` | `outside_sql` | This LEAST or GREATEST operation is not supported | [outside_sql] |
|
|
325
|
+
| `FromFunction` | `outside_sql` | FROM table functions require exactly one UNNEST call | [outside_sql] |
|
|
326
|
+
| `FromItem` | `outside_sql` | This FROM item is not supported | [outside_sql] |
|
|
327
|
+
| `FullJoinUsing` | `outside_sql` | FULL JOIN USING is not supported; use FULL JOIN ON and project COALESCE(left_key, right_key) | [outside_sql] |
|
|
328
|
+
| `FullPartitionFrame` | `outside_sql` | LAST_VALUE requires an explicit full-partition frame | [outside_sql] |
|
|
329
|
+
| `FunctionQualification` | `outside_sql` | Schema-qualified function names are not supported | [outside_sql] |
|
|
330
|
+
| `GroupingField` | `outside_sql` | Grouping-set keys must be direct field references | [outside_sql] |
|
|
331
|
+
| `GroupingKeyType` | `outside_sql` | DISTINCT grouping-set keys must be TEXT or DOUBLE fields | [outside_sql] |
|
|
332
|
+
| `HavingAggregateMath` | `outside_sql` | Math over aggregates in HAVING requires a grouped subquery; compute the aggregate then filter its output with WHERE | [outside_sql] |
|
|
333
|
+
| `HavingRewrite` | `outside_sql` | This HAVING expression has no supported equivalent subquery rewrite | [outside_sql] |
|
|
334
|
+
| `HavingSubquery` | `outside_sql` | HAVING subqueries require ordinary GROUP BY, no CTE or window, and output-name or ordinal ordering | [outside_sql] |
|
|
335
|
+
| `JoinAliases` | `outside_sql` | JOIN aliases, NATURAL JOIN, and JOIN USING aliases are not supported | [outside_sql] |
|
|
336
|
+
| `JoinKind` | `outside_sql` | Only INNER, LEFT, RIGHT, FULL, and CROSS JOIN are supported | [outside_sql] |
|
|
337
|
+
| `JoinMembership` | `outside_sql` | JOIN membership requires inner-only joins or a two-source LEFT JOIN with qualified side-local predicates | [outside_sql] |
|
|
338
|
+
| `JoinNesting` | `outside_sql` | Right-nested or aliased JOIN groups are not supported | [outside_sql] |
|
|
339
|
+
| `JoinUsingName` | `outside_sql` | JOIN USING requires valid column names | [outside_sql] |
|
|
340
|
+
| `LiteralKind` | `outside_sql` | This literal form is not supported | [outside_sql] |
|
|
341
|
+
| `MembershipArity` | `outside_sql` | A scalar membership expression requires one operand | [outside_sql] |
|
|
342
|
+
| `MembershipCTE` | `outside_sql` | Membership CTEs must be nonrecursive and have no column alias list or nested expression subquery | [outside_sql] |
|
|
343
|
+
| `MembershipComparison` | `outside_sql` | Subquery membership supports IN and equality ANY only | [outside_sql] |
|
|
344
|
+
| `MembershipKeyType` | `outside_sql` | Membership keys must be numeric or TEXT | [outside_sql] |
|
|
345
|
+
| `MembershipOperand` | `outside_sql` | A membership operand must be a column, literal, or parameter | [outside_sql] |
|
|
346
|
+
| `MembershipSource` | `outside_sql` | This membership source requires a FROM relation | [outside_sql] |
|
|
347
|
+
| `MixedOuterJoin` | `outside_sql` | RIGHT or FULL JOIN cannot be mixed with comma-separated FROM groups; use one explicit JOIN chain | [outside_sql] |
|
|
348
|
+
| `NestedMembership` | `outside_sql` | A membership operand cannot contain nested subqueries | [outside_sql] |
|
|
349
|
+
| `NestedScalar` | `outside_sql` | Nested scalar subquery operands are not supported | [outside_sql] |
|
|
350
|
+
| `NotArity` | `outside_sql` | NOT requires one operand | [outside_sql] |
|
|
351
|
+
| `NthValueArity` | `outside_sql` | NTH_VALUE requires two arguments | [outside_sql] |
|
|
352
|
+
| `NthValueShape` | `outside_sql` | NTH_VALUE requires a direct projection over one table, a positive literal index, numeric or TEXT values, and stable ordering including rec_id | [outside_sql] |
|
|
353
|
+
| `ObjectMember` | `outside_sql` | Object member access requires exactly one field in the form (expression).field | [outside_sql] |
|
|
354
|
+
| `ObjectSubscript` | `outside_sql` | Array subscripts and empty object member names are not supported | [outside_sql] |
|
|
355
|
+
| `OperatorMissing` | `outside_sql` | An operator name is required | [outside_sql] |
|
|
356
|
+
| `OrderItem` | `outside_sql` | This ORDER BY item is not supported | [outside_sql] |
|
|
357
|
+
| `OrderUsing` | `outside_sql` | ORDER BY USING is not supported | [outside_sql] |
|
|
358
|
+
| `RecursiveShape` | `outside_sql` | A recursive CTE requires UNION or UNION ALL between its anchor and recursive term | [outside_sql] |
|
|
359
|
+
| `RowKeyType` | `outside_sql` | Row IN requires TEXT or DOUBLE keys; NOT IN also requires non-null keys on both sides | [outside_sql] |
|
|
360
|
+
| `RowLock` | `outside_sql` | SELECT row locking is not supported | [outside_sql] |
|
|
361
|
+
| `RowMembership` | `outside_sql` | Row membership requires an uncorrelated simple source and a top-level WHERE conjunct; nullable row NOT IN is not supported | [outside_sql] |
|
|
362
|
+
| `ScalarAggregateOperand` | `outside_sql` | Scalar subquery operands require a single uncorrelated COUNT, SUM, AVG, MIN, or MAX in a non-grouped context | [outside_sql] |
|
|
363
|
+
| `SelectClause` | `outside_sql` | This SELECT clause is not supported | [outside_sql] |
|
|
364
|
+
| `SelectOnly` | `outside_sql` | Only SELECT statements are supported | [outside_sql] |
|
|
365
|
+
| `SelectRelation` | `outside_sql` | A CTE or derived relation must contain SELECT | [outside_sql] |
|
|
366
|
+
| `SelectTarget` | `outside_sql` | This SELECT target is not supported | [outside_sql] |
|
|
367
|
+
| `SetBranches` | `outside_sql` | A set operation requires two SELECT branches | [outside_sql] |
|
|
368
|
+
| `SetOperation` | `outside_sql` | This set operation is not supported | [outside_sql] |
|
|
369
|
+
| `StarAlias` | `outside_sql` | A star projection cannot have an alias | [outside_sql] |
|
|
370
|
+
| `StarContext` | `outside_sql` | A star is only valid in SELECT projection | [outside_sql] |
|
|
371
|
+
| `StarJoinUsing` | `outside_sql` | SELECT * with JOIN USING requires explicit columns or a qualified alias.* | [outside_sql] |
|
|
372
|
+
| `StarQualification` | `outside_sql` | Use * or table_alias.* for a star projection | [outside_sql] |
|
|
373
|
+
| `StarUnnest` | `outside_sql` | Select the UNNEST alias explicitly instead of a star projection | [outside_sql] |
|
|
374
|
+
| `StringAggregationForm` | `outside_sql` | STRING_AGG requires a literal separator without DISTINCT, FILTER, or OVER | An equivalent SQL form preserving ordering, filtering, and duplicate behavior has not been verified. [outside_sql] |
|
|
375
|
+
| `StringAggregationSeparator` | `outside_sql` | STRING_AGG requires an ASCII separator without a zero byte | Replacing the requested separator would change the result. [outside_sql] |
|
|
376
|
+
| `SubqueryForm` | `outside_sql` | This subquery form is not supported | [outside_sql] |
|
|
377
|
+
| `SymmetricSubquery` | `outside_sql` | BETWEEN SYMMETRIC does not support subquery operands | [outside_sql] |
|
|
378
|
+
| `TableColumnAliases` | `outside_sql` | Table column alias lists are not supported | [outside_sql] |
|
|
379
|
+
| `TableQualification` | `outside_sql` | Schema-qualified table names are not supported | [outside_sql] |
|
|
380
|
+
| `TemporalLiteral` | `outside_sql` | Only TIMESTAMP and INTERVAL typed literals are supported | [outside_sql] |
|
|
381
|
+
| `TextPosition` | `outside_sql` | Character-based text position functions are not supported | [outside_sql] |
|
|
382
|
+
| `TrimCharacters` | `outside_sql` | TRIM with PostgreSQL character semantics is not supported | Changing the trim spelling does not enable this operation. [outside_sql] |
|
|
383
|
+
| `TypeName` | `outside_sql` | This type name is not supported | [outside_sql] |
|
|
384
|
+
| `UnnestArity` | `outside_sql` | UNNEST requires exactly one argument | [outside_sql] |
|
|
385
|
+
| `UnnestForm` | `outside_sql` | UNNEST WITH ORDINALITY, ROWS FROM, and column definitions are not supported | [outside_sql] |
|
|
386
|
+
| `ValueFunction` | `outside_sql` | This SQL value function is not supported | [outside_sql] |
|
|
387
|
+
| `ValueMemberKey` | `outside_sql` | Value membership requires TEXT or DOUBLE keys; computed INT keys are not supported | [outside_sql] |
|
|
388
|
+
| `ValueSubqueryType` | `outside_sql` | Value subqueries require scalar numeric or TEXT operands without outer aggregates or windows | [outside_sql] |
|
|
389
|
+
| `WindowInheritance` | `outside_sql` | A window cannot copy a frame or override inherited PARTITION BY or ORDER BY | [outside_sql] |
|
|
390
|
+
| `WindowName` | `outside_sql` | A WINDOW definition must have a name | [outside_sql] |
|
|
391
|
+
| `WithTies` | `outside_sql` | FETCH FIRST WITH TIES is not supported | [outside_sql] |
|
|
392
|
+
|
|
393
|
+
## Rewrites that must not be substituted
|
|
394
|
+
|
|
395
|
+
- `SQL_UNSUPPORTED_SYNTAX`: A SELECT subquery does not make the rejected comparison executable.
|
|
396
|
+
- `SQL_UNSUPPORTED_SYNTAX`: Changing dimension 2 to dimension 1 changes NULL into an array length. Changing the dimension can change the result.
|
|
397
|
+
- `SQL_UNSUPPORTED_SYNTAX`: Returning an object or address does not preserve a numeric coordinate. An address or complete object is not an equivalent result.
|
|
398
|
+
- `SQL_UNSUPPORTED_SYNTAX`: An unqualified UNNEST recommendation can change row multiplicity; no general equivalent is proved. An equivalent SQL rewrite preserving row multiplicity has not been verified.
|
|
399
|
+
- `SQL_UNSUPPORTED_SYNTAX`: Adding an arbitrary FROM relation changes row count, including on empty input. Adding an arbitrary table can change row count.
|
|
400
|
+
- `SQL_INVALID_CAST`: The formatted timestamp differs by eight hours between Base SQL execution and the PostgreSQL query; do not recommend this SQL as equivalent. Calendar fields and the intended timezone must be validated before conversion; no equivalent SQL format has been verified.
|
|
401
|
+
- `SQL_FUNCTION_NOT_FOUND`: Base SQL does not accept IS NOT DISTINCT FROM, which this rewrite needs to match NULL partition keys; no equivalent SQL rewrite has been verified. Preserve the first value under the intended ordering and NULL semantics.
|
|
402
|
+
- `SQL_FUNCTION_NOT_FOUND`: Base SQL does not accept IS NOT DISTINCT FROM, which this rewrite needs to match NULL partition keys; no equivalent SQL rewrite has been verified. Preserve the last value under the intended ordering and NULL semantics.
|
|
403
|
+
- `SQL_FUNCTION_NOT_FOUND`: Base SQL does not accept IS NOT DISTINCT FROM, which this rewrite needs to match NULL partition keys; no equivalent SQL rewrite has been verified. Preserve the requested position and return NULL for short partitions.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Database Function 能力边界
|
|
2
|
+
|
|
3
|
+
在判断查询能力或处理编译与运行期错误时,以服务端诊断及[目录生成的错误与替代写法](base-sql-errors.generated.md)为事实源。这里保留参数协议和生成原则,不维护第二份函数或语法支持清单。
|
|
4
|
+
|
|
5
|
+
## 判断与默认路径
|
|
6
|
+
|
|
7
|
+
原则:先确认业务要保留的结果语义,再选择查询形式。判定时按诊断的位置、语义码和 Catalog 类型定位问题;默认采用生成参考中与当前条件匹配、已有验证的形式,并逐项核对其前提。
|
|
8
|
+
|
|
9
|
+
例外:目录没有等价 SQL、前提不成立或改写会改变空值、行数及排序时,转到[SQL 外实现放在哪](../SKILL.md#sql-外实现放在哪)选择消费结果的实现位置。单个组合失败不代表组成它的所有能力都不可用;版本或运行环境不一致时,保留诊断和 LogID,先核对事实源。
|
|
10
|
+
|
|
11
|
+
## Stored Query 与分页
|
|
12
|
+
|
|
13
|
+
- 参数 kind 不使用 `OPTION`;SingleSelect 选项名使用 `TEXT` 参数,并在 Page/FaaS 按 Catalog 选项白名单约束输入后显式比较 `(option_field).name`。
|
|
14
|
+
- 不把 `OPTION`、`USER`、`CHAT`、`FILE`、`LOCATION`、`URL` 等对象类型声明为业务参数;参数只使用六种基础类型及其一维数组,允许的 null 位置以生成的 Schema 为准。
|
|
15
|
+
- 不通过移除服务端筛选、读取固定前 N 条后在 Page 分页来声称完整分页或全量导出。
|
|
16
|
+
|
|
17
|
+
## 查询生成边界
|
|
18
|
+
|
|
19
|
+
默认逐列投影,保持输出 Schema 稳定;连接的每一侧使用明确的表或带别名的派生表,分阶段表达复杂查询。常规生成优先简单连接、顶层查询与带别名的派生表,而不是依靠深层组合表达全部业务逻辑。确需复杂组合时,依据生成参考和目标环境验证决定,而不将生成偏好当作平台能力结论。
|
|
20
|
+
|
|
21
|
+
Database Function 需要 Catalog 中真实表依赖,以确定数据上下文;与 Base 数据无关的计算按[SQL 外实现放在哪](../SKILL.md#sql-外实现放在哪)处理。动态返回规模由调用方校验为非负整数并限制最大值;服务端资源预算以诊断中的实际限制为准。
|
|
22
|
+
|
|
23
|
+
## 按位置取值
|
|
24
|
+
|
|
25
|
+
先明确分区、排序、并列值与空分区的业务含义,再查[生成参考中的修复策略](base-sql-errors.generated.md)。默认只采用满足前提的已验证形式;没有等价形式时沿用[SQL 外实现选择原则](../SKILL.md#sql-外实现放在哪)。
|
|
26
|
+
|
|
27
|
+
## NULL 与数值边界
|
|
28
|
+
|
|
29
|
+
改写前明确空值、空集合、数值精度和错误行为是否属于结果契约。默认保留业务所需语义,并按[生成参考的前提与验证说明](base-sql-errors.generated.md)选择修法;防护写法会改变错误行为时,先确认业务接受该变化。需要 SQL 外处理的部分统一按[实现位置原则](../SKILL.md#sql-外实现放在哪)决定,不把截断结果或丢失空值的结果当作等价替代。
|