@lark-base-open/base-database-cli 1.3.8 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/archive.d.ts +16 -2
  3. package/dist/archive.d.ts.map +1 -1
  4. package/dist/archive.js +59 -13
  5. package/dist/archive.js.map +1 -1
  6. package/dist/function-description.d.ts +6 -0
  7. package/dist/function-description.d.ts.map +1 -0
  8. package/dist/function-description.js +29 -0
  9. package/dist/function-description.js.map +1 -0
  10. package/dist/lark-cli-error.d.ts +1 -0
  11. package/dist/lark-cli-error.d.ts.map +1 -1
  12. package/dist/lark-cli-error.js +5 -0
  13. package/dist/lark-cli-error.js.map +1 -1
  14. package/dist/mutation.d.ts +1 -1
  15. package/dist/mutation.d.ts.map +1 -1
  16. package/dist/mutation.js +5 -5
  17. package/dist/mutation.js.map +1 -1
  18. package/dist/project-context.d.ts.map +1 -1
  19. package/dist/project-context.js +42 -6
  20. package/dist/project-context.js.map +1 -1
  21. package/package.json +1 -1
  22. package/skills/lark-base-database/SKILL.md +2 -0
  23. package/skills/lark-base-database/references/ai-function.md +7 -3
  24. package/skills/lark-base-database/references/base-sql-errors.generated.md +482 -40
  25. package/skills/lark-base-database/references/database-function.md +26 -3
  26. package/skills/lark-base-database/references/development.md +2 -0
  27. package/skills/lark-base-database/references/faas.md +3 -1
  28. package/skills/lark-base-database/references/mutations.md +4 -4
  29. package/templates/database-starter/mutations/README.md +1 -1
  30. package/templates/database-starter/page/package-lock.json +4 -4
  31. package/templates/database-starter/page/package.json +1 -1
  32. package/templates/database-starter/page/src/components/floating-button/index.tsx +18 -20
  33. package/templates/database-starter/page/src/components/floating-button/utils/request-edit.test.ts +42 -0
  34. package/templates/database-starter/page/src/components/floating-button/utils/request-edit.ts +21 -0
  35. package/templates/database-starter/page/src/main.test.ts +28 -0
  36. package/templates/database-starter/page/src/main.tsx +2 -0
@@ -5,15 +5,92 @@ Use names and types from catalog.json. Refresh the Catalog when the schema chang
5
5
 
6
6
  ## Verified SQL forms
7
7
 
8
+ ### FIRST_VALUE over a full partition
9
+
10
+ <a id="shared-wording-1"></a>
11
+ Rank by the intended order using ROW_NUMBER() in a subquery; then MAX(CASE WHEN rn=1 THEN value END) OVER (PARTITION BY k).
12
+
13
+ <a id="shared-wording-2"></a>
14
+ Preconditions: Full-partition semantics only; INT, DOUBLE or TEXT values supported by MAX; arrays and other types are excluded. Use a unique total ordering key and preserve explicit NULL ordering; N is a query-constant positive integer (literal or parameter). Reverse both directions and NULL ordering for LAST_VALUE.
15
+
16
+ <a id="shared-wording-3"></a>
17
+ Validation kind: `equivalent`. Error code: `SQL_FUNCTION_NOT_FOUND`.
18
+
19
+ <a id="shared-wording-4"></a>
20
+ The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
21
+
22
+ ```sql
23
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders), ranked AS (SELECT id, group_key, value, ROW_NUMBER() OVER (PARTITION BY group_key ORDER BY sort_key ASC NULLS LAST, id ASC) AS rn FROM source) SELECT id, MAX(CASE WHEN rn = 1 THEN value END) OVER (PARTITION BY group_key) AS value FROM ranked ORDER BY id;
24
+ ```
25
+
26
+ ### LAST_VALUE over a full partition
27
+
28
+ Reverse the order directions and NULL ordering for ROW_NUMBER(); then MAX(CASE WHEN rn=1 THEN value END) OVER (PARTITION BY k).
29
+
30
+ Preconditions for LAST_VALUE over a full partition: [shared wording](#shared-wording-2).
31
+
32
+ Validation kind for LAST_VALUE over a full partition: [shared wording](#shared-wording-3).
33
+
34
+ Example names for LAST_VALUE over a full partition: [shared wording](#shared-wording-4).
35
+
36
+ ```sql
37
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders), ranked AS (SELECT id, group_key, value, ROW_NUMBER() OVER (PARTITION BY group_key ORDER BY sort_key DESC NULLS FIRST, id DESC) AS rn FROM source) SELECT id, MAX(CASE WHEN rn = 1 THEN value END) OVER (PARTITION BY group_key) AS value FROM ranked ORDER BY id;
38
+ ```
39
+
40
+ ### NTH_VALUE over a full partition
41
+
42
+ <a id="shared-wording-5"></a>
43
+ Rank by the intended order using ROW_NUMBER() in a subquery; then MAX(CASE WHEN rn=N THEN value END) OVER (PARTITION BY k), with fixed positive N.
44
+
45
+ Preconditions for NTH_VALUE over a full partition: [shared wording](#shared-wording-2).
46
+
47
+ Validation kind for NTH_VALUE over a full partition: [shared wording](#shared-wording-3).
48
+
49
+ Example names for NTH_VALUE over a full partition: [shared wording](#shared-wording-4).
50
+
51
+ ```sql
52
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders), ranked AS (SELECT id, group_key, value, ROW_NUMBER() OVER (PARTITION BY group_key ORDER BY sort_key ASC NULLS LAST, id ASC) AS rn FROM source) SELECT id, MAX(CASE WHEN rn = 2 THEN value END) OVER (PARTITION BY group_key) AS value FROM ranked ORDER BY id;
53
+ ```
54
+
55
+ ### NTH_VALUE with a short partition
56
+
57
+ Guidance for NTH_VALUE with a short partition: [shared wording](#shared-wording-5).
58
+
59
+ Preconditions for NTH_VALUE with a short partition: [shared wording](#shared-wording-2).
60
+
61
+ Validation kind for NTH_VALUE with a short partition: [shared wording](#shared-wording-3).
62
+
63
+ Example names for NTH_VALUE with a short partition: [shared wording](#shared-wording-4).
64
+
65
+ ```sql
66
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders), ranked AS (SELECT id, group_key, value, ROW_NUMBER() OVER (PARTITION BY group_key ORDER BY sort_key ASC NULLS LAST, id ASC) AS rn FROM source) SELECT id, MAX(CASE WHEN rn = 100 THEN value END) OVER (PARTITION BY group_key) AS value FROM ranked ORDER BY id;
67
+ ```
68
+
69
+ ### FIRST_VALUE with empty input
70
+
71
+ Guidance for FIRST_VALUE with empty input: [shared wording](#shared-wording-1).
72
+
73
+ Preconditions for FIRST_VALUE with empty input: [shared wording](#shared-wording-2).
74
+
75
+ Validation kind for FIRST_VALUE with empty input: [shared wording](#shared-wording-3).
76
+
77
+ Example names for FIRST_VALUE with empty input: [shared wording](#shared-wording-4).
78
+
79
+ ```sql
80
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders WHERE FALSE), ranked AS (SELECT id, group_key, value, ROW_NUMBER() OVER (PARTITION BY group_key ORDER BY sort_key ASC NULLS LAST, id ASC) AS rn FROM source) SELECT id, MAX(CASE WHEN rn = 1 THEN value END) OVER (PARTITION BY group_key) AS value FROM ranked ORDER BY id;
81
+ ```
82
+
8
83
  ### Division with a zero divisor
9
84
 
85
+ <a id="shared-wording-6"></a>
10
86
  Use NULLIF(divisor, 0) as the divisor if a NULL result is acceptable.
11
87
 
12
88
  Preconditions: The caller accepts NULL instead of a division-by-zero error.
13
89
 
90
+ <a id="shared-wording-7"></a>
14
91
  Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
15
92
 
16
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
93
+ Example names for Division with a zero divisor: [shared wording](#shared-wording-4).
17
94
 
18
95
  ```sql
19
96
  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;
@@ -21,13 +98,13 @@ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM
21
98
 
22
99
  ### Division with a nonzero divisor
23
100
 
24
- Use NULLIF(divisor, 0) as the divisor if a NULL result is acceptable.
101
+ Guidance for Division with a nonzero divisor: [shared wording](#shared-wording-6).
25
102
 
26
103
  Preconditions: For a nonzero divisor the value must be unchanged.
27
104
 
28
- Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
105
+ Validation kind for Division with a nonzero divisor: [shared wording](#shared-wording-7).
29
106
 
30
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
107
+ Example names for Division with a nonzero divisor: [shared wording](#shared-wording-4).
31
108
 
32
109
  ```sql
33
110
  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;
@@ -41,7 +118,7 @@ Preconditions: Move the window output into a subquery before filtering; this cor
41
118
 
42
119
  Validation kind: `author`. Error code: `SQL_WINDOW_NOT_ALLOWED`.
43
120
 
44
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
121
+ Example names for Filter a window output in a subquery: [shared wording](#shared-wording-4).
45
122
 
46
123
  ```sql
47
124
  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;
@@ -55,7 +132,7 @@ Preconditions: Choose the intended PostgreSQL format; this example uses the full
55
132
 
56
133
  Validation kind: `author`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
57
134
 
58
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
135
+ Example names for Use the PostgreSQL TO_CHAR spelling: [shared wording](#shared-wording-4).
59
136
 
60
137
  ```sql
61
138
  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;
@@ -69,7 +146,7 @@ Preconditions: Choose the intended public type; the example chooses TEXT.
69
146
 
70
147
  Validation kind: `author`. Error code: `SQL_UNTYPED_NULL`.
71
148
 
72
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
149
+ Example names for Give NULL an explicit public type: [shared wording](#shared-wording-4).
73
150
 
74
151
  ```sql
75
152
  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;
@@ -81,9 +158,10 @@ For an equality comparison to a grouped MAX, aggregate by the correlation key in
81
158
 
82
159
  Preconditions: Equality to a correlated MAX grouped by the correlation key; preserve NULL keys and empty groups.
83
160
 
161
+ <a id="shared-wording-8"></a>
84
162
  Validation kind: `equivalent`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
85
163
 
86
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
164
+ Example names for Correlated max join: [shared wording](#shared-wording-4).
87
165
 
88
166
  ```sql
89
167
  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;
@@ -93,11 +171,11 @@ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM
93
171
 
94
172
  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
173
 
96
- Preconditions: The intent is byte count, not character count. The fixture includes non-ASCII text and NULL values.
174
+ Preconditions: The intent is byte count, not character count. Applies to non-ASCII text and NULL inputs.
97
175
 
98
- Validation kind: `equivalent`. Error code: `SQL_FUNCTION_NOT_FOUND`.
176
+ Validation kind for Octet length bytes: [shared wording](#shared-wording-3).
99
177
 
100
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
178
+ Example names for Octet length bytes: [shared wording](#shared-wording-4).
101
179
 
102
180
  ```sql
103
181
  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;
@@ -105,13 +183,16 @@ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM
105
183
 
106
184
  ### Array scalar containment
107
185
 
186
+ <a id="shared-wording-9"></a>
108
187
  Both operands must be arrays of compatible element types. For single-value containment, wrap the scalar in a one-element array.
109
188
 
189
+ <a id="shared-wording-10"></a>
110
190
  Preconditions: Single-value array containment is intended; include NULL input and unmatched elements.
111
191
 
192
+ <a id="shared-wording-11"></a>
112
193
  Validation kind: `equivalent`. Error code: `SQL_OPERATOR_TYPE_MISMATCH`.
113
194
 
114
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
195
+ Example names for Array scalar containment: [shared wording](#shared-wording-4).
115
196
 
116
197
  ```sql
117
198
  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;
@@ -119,13 +200,13 @@ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM
119
200
 
120
201
  ### Array scalar contains
121
202
 
122
- Both operands must be arrays of compatible element types. For single-value containment, wrap the scalar in a one-element array.
203
+ Guidance for Array scalar contains: [shared wording](#shared-wording-9).
123
204
 
124
- Preconditions: Single-value array containment is intended; include NULL input and unmatched elements.
205
+ Preconditions for Array scalar contains: [shared wording](#shared-wording-10).
125
206
 
126
- Validation kind: `equivalent`. Error code: `SQL_OPERATOR_TYPE_MISMATCH`.
207
+ Validation kind for Array scalar contains: [shared wording](#shared-wording-11).
127
208
 
128
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
209
+ Example names for Array scalar contains: [shared wording](#shared-wording-4).
129
210
 
130
211
  ```sql
131
212
  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;
@@ -137,9 +218,10 @@ Use a BOOL condition. If the intent is to exclude zero, compare the numeric expr
137
218
 
138
219
  Preconditions: The explicitly selected intent is to exclude numeric zero and NULL.
139
220
 
221
+ <a id="shared-wording-12"></a>
140
222
  Validation kind: `author`. Error code: `SQL_WHERE_TYPE_MISMATCH`.
141
223
 
142
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
224
+ Example names for Numeric predicate: [shared wording](#shared-wording-4).
143
225
 
144
226
  ```sql
145
227
  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;
@@ -151,9 +233,9 @@ Use a BOOL condition. If the intent is to exclude empty text, compare the text e
151
233
 
152
234
  Preconditions: The explicitly selected intent is to exclude empty text and NULL.
153
235
 
154
- Validation kind: `author`. Error code: `SQL_WHERE_TYPE_MISMATCH`.
236
+ Validation kind for Text predicate: [shared wording](#shared-wording-12).
155
237
 
156
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
238
+ Example names for Text predicate: [shared wording](#shared-wording-4).
157
239
 
158
240
  ```sql
159
241
  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;
@@ -161,13 +243,14 @@ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM
161
243
 
162
244
  ### Remainder nullif
163
245
 
246
+ <a id="shared-wording-13"></a>
164
247
  Use NULLIF(divisor, 0) as the remainder divisor if a NULL result is acceptable.
165
248
 
166
249
  Preconditions: Returning NULL instead of an error for a zero remainder divisor is acceptable.
167
250
 
168
- Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
251
+ Validation kind for Remainder nullif: [shared wording](#shared-wording-7).
169
252
 
170
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
253
+ Example names for Remainder nullif: [shared wording](#shared-wording-4).
171
254
 
172
255
  ```sql
173
256
  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;
@@ -175,13 +258,13 @@ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM
175
258
 
176
259
  ### Remainder nullif nonzero
177
260
 
178
- Use NULLIF(divisor, 0) as the remainder divisor if a NULL result is acceptable.
261
+ Guidance for Remainder nullif nonzero: [shared wording](#shared-wording-13).
179
262
 
180
263
  Preconditions: Integer-valued sort keys; verify that the guard preserves a nonzero divisor.
181
264
 
182
- Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
265
+ Validation kind for Remainder nullif nonzero: [shared wording](#shared-wording-7).
183
266
 
184
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
267
+ Example names for Remainder nullif nonzero: [shared wording](#shared-wording-4).
185
268
 
186
269
  ```sql
187
270
  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;
@@ -193,9 +276,10 @@ Use an optional sign and decimal digits for INT input, for example '123'. Supply
193
276
 
194
277
  Preconditions: The caller explicitly supplies the value 123; this example must not replace an unknown intended value.
195
278
 
279
+ <a id="shared-wording-14"></a>
196
280
  Validation kind: `author`. Error code: `SQL_INVALID_CAST`.
197
281
 
198
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
282
+ Example names for Cast int format: [shared wording](#shared-wording-4).
199
283
 
200
284
  ```sql
201
285
  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;
@@ -207,9 +291,9 @@ Use a finite decimal number for DOUBLE input, for example '1.25'. Supply the int
207
291
 
208
292
  Preconditions: The caller explicitly supplies the finite decimal value 1.25.
209
293
 
210
- Validation kind: `author`. Error code: `SQL_INVALID_CAST`.
294
+ Validation kind for Cast double format: [shared wording](#shared-wording-14).
211
295
 
212
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
296
+ Example names for Cast double format: [shared wording](#shared-wording-4).
213
297
 
214
298
  ```sql
215
299
  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;
@@ -221,26 +305,362 @@ Compute OPTION.name in a derived table first, then construct ARRAY from that pro
221
305
 
222
306
  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
307
 
224
- Validation kind: `equivalent`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
308
+ Validation kind for Materialize option names before array construction: [shared wording](#shared-wording-8).
225
309
 
226
- The example uses an `orders` table with `group_key`, `sort_key`, `value`, and `text_value` columns. Replace these with exact Catalog names.
310
+ Example names for Materialize option names before array construction: [shared wording](#shared-wording-4).
227
311
 
228
312
  ```sql
229
313
  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
314
  ```
231
315
 
232
- ## Unsupported diagnostics
316
+ ### First value int
317
+
318
+ Guidance for First value int: [shared wording](#shared-wording-1).
319
+
320
+ Preconditions for First value int: [shared wording](#shared-wording-2).
321
+
322
+ Validation kind for First value int: [shared wording](#shared-wording-3).
323
+
324
+ Example names for First value int: [shared wording](#shared-wording-4).
325
+
326
+ ```sql
327
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders), ranked AS (SELECT id, group_key, CAST(sort_key AS BIGINT) AS value, ROW_NUMBER() OVER (PARTITION BY group_key ORDER BY sort_key ASC NULLS LAST, id ASC) AS rn FROM source) SELECT id, MAX(CASE WHEN rn = 1 THEN value END) OVER (PARTITION BY group_key) AS value FROM ranked ORDER BY id;
328
+ ```
329
+
330
+ ### First value text
331
+
332
+ Guidance for First value text: [shared wording](#shared-wording-1).
333
+
334
+ Preconditions for First value text: [shared wording](#shared-wording-2).
335
+
336
+ Validation kind for First value text: [shared wording](#shared-wording-3).
337
+
338
+ Example names for First value text: [shared wording](#shared-wording-4).
339
+
340
+ ```sql
341
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders), ranked AS (SELECT id, group_key, text_value AS value, ROW_NUMBER() OVER (PARTITION BY group_key ORDER BY sort_key ASC NULLS LAST, id ASC) AS rn FROM source) SELECT id, MAX(CASE WHEN rn = 1 THEN value END) OVER (PARTITION BY group_key) AS value FROM ranked ORDER BY id;
342
+ ```
343
+
344
+ ### In null where
345
+
346
+ <a id="shared-wording-15"></a>
347
+ Direct WHERE/HAVING/JOIN ON: remove NULL items; use FALSE if empty. Adding OR x IS NULL changes intent to include NULL rows. Not equivalent under NOT or in projection.
348
+
349
+ <a id="shared-wording-16"></a>
350
+ Preconditions: Use directly as a WHERE/HAVING/JOIN ON predicate, not under NOT or truth-value inspection. WHERE, HAVING or JOIN ON filtering only; remove only explicit NULL list items. No equivalence is claimed for projection or an intent to include NULL rows.
351
+
352
+ <a id="shared-wording-17"></a>
353
+ Validation kind: `equivalent`. Error code: `SQL_UNSUPPORTED_SYNTAX_NULL_IN_LIST`.
354
+
355
+ Example names for In null where: [shared wording](#shared-wording-4).
356
+
357
+ ```sql
358
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id FROM source WHERE value IN (2.5, 0.0) ORDER BY id;
359
+ ```
360
+
361
+ ### In null having
362
+
363
+ Direct WHERE/HAVING/JOIN ON for In null having: [shared wording](#shared-wording-15).
364
+
365
+ Preconditions for In null having: [shared wording](#shared-wording-16).
366
+
367
+ Validation kind for In null having: [shared wording](#shared-wording-17).
368
+
369
+ Example names for In null having: [shared wording](#shared-wording-4).
370
+
371
+ ```sql
372
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT group_key, MAX(value) AS value FROM source GROUP BY group_key HAVING MAX(value) IN (2.5, 0.0) ORDER BY group_key NULLS LAST;
373
+ ```
374
+
375
+ ### In null join
376
+
377
+ Direct WHERE/HAVING/JOIN ON for In null join: [shared wording](#shared-wording-15).
378
+
379
+ Preconditions for In null join: [shared wording](#shared-wording-16).
380
+
381
+ Validation kind for In null join: [shared wording](#shared-wording-17).
382
+
383
+ Example names for In null join: [shared wording](#shared-wording-4).
384
+
385
+ ```sql
386
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT a.id, b.id AS other_id FROM source a JOIN source b ON a.id = b.id AND a.value IN (2.5, 0.0) ORDER BY a.id, b.id;
387
+ ```
388
+
389
+ ### In null left join
390
+
391
+ Direct WHERE/HAVING/JOIN ON for In null left join: [shared wording](#shared-wording-15).
392
+
393
+ Preconditions for In null left join: [shared wording](#shared-wording-16).
394
+
395
+ Validation kind for In null left join: [shared wording](#shared-wording-17).
396
+
397
+ Example names for In null left join: [shared wording](#shared-wording-4).
398
+
399
+ ```sql
400
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT a.id, b.id AS other_id FROM source a LEFT JOIN source b ON a.id = b.id AND a.value IN (2.5, 0.0) ORDER BY a.id, b.id;
401
+ ```
402
+
403
+ ### In null include null intent
404
+
405
+ Direct WHERE/HAVING/JOIN ON for In null include null intent: [shared wording](#shared-wording-15).
406
+
407
+ Preconditions: Use directly as a WHERE/HAVING/JOIN ON predicate, not under NOT or truth-value inspection. Only if the requested intent explicitly includes NULL rows.
408
+
409
+ <a id="shared-wording-18"></a>
410
+ Validation kind: `author`. Error code: `SQL_UNSUPPORTED_SYNTAX_NULL_IN_LIST`.
411
+
412
+ Example names for In null include null intent: [shared wording](#shared-wording-4).
413
+
414
+ ```sql
415
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id FROM source WHERE value IN (2.5, 0.0) OR value IS NULL ORDER BY id;
416
+ ```
417
+
418
+ ### Not in null filter
419
+
420
+ <a id="shared-wording-19"></a>
421
+ Direct filters: FALSE preserves no matches. To change intent, use x NOT IN (...) AND x IS NOT NULL, or x IS NOT NULL for an empty remaining list. Neither works under NOT or in projection.
422
+
423
+ Preconditions: Use directly as a WHERE/HAVING/JOIN ON predicate, not under NOT or truth-value inspection. Filtering context only. FALSE preserves the original empty match set; excluding listed values and NULL rows is an intent change, not an equivalent replacement.
424
+
425
+ Validation kind for Not in null filter: [shared wording](#shared-wording-17).
426
+
427
+ Example names for Not in null filter: [shared wording](#shared-wording-4).
428
+
429
+ ```sql
430
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id FROM source WHERE FALSE ORDER BY id;
431
+ ```
432
+
433
+ ### Not in null intent
434
+
435
+ Direct filters for Not in null intent: [shared wording](#shared-wording-19).
436
+
437
+ Preconditions: Use directly as a WHERE/HAVING/JOIN ON predicate, not under NOT or truth-value inspection. Only if excluding listed values and NULL rows is the explicitly selected intent.
438
+
439
+ Validation kind for Not in null intent: [shared wording](#shared-wording-18).
440
+
441
+ Example names for Not in null intent: [shared wording](#shared-wording-4).
442
+
443
+ ```sql
444
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id FROM source WHERE value NOT IN (2.5, 0.0) AND value IS NOT NULL ORDER BY id;
445
+ ```
446
+
447
+ ### In null only filter
448
+
449
+ Direct WHERE/HAVING/JOIN ON for In null only filter: [shared wording](#shared-wording-15).
450
+
451
+ Preconditions: Use directly as a WHERE/HAVING/JOIN ON predicate, not under NOT or truth-value inspection. Filtering context only; an all-NULL list has no matching rows. Projection requires preserving its three-valued result.
452
+
453
+ Validation kind for In null only filter: [shared wording](#shared-wording-17).
454
+
455
+ Example names for In null only filter: [shared wording](#shared-wording-4).
456
+
457
+ ```sql
458
+ WITH source AS (SELECT rec_id AS id, group_key, sort_key, value, text_value FROM orders) SELECT id FROM source WHERE FALSE ORDER BY id;
459
+ ```
460
+
461
+ ### OPTION member comparison: equal
462
+
463
+ <a id="shared-wording-20"></a>
464
+ Compare .name for labels or .id for option IDs, using matching TEXT operands.
465
+
466
+ <a id="shared-wording-21"></a>
467
+ Preconditions: Author correction only: choose .name for option labels or .id for option IDs and supply matching text operands. This Base must support the member operation and the chosen predicate; target-capability rejection remains unchanged on older Bases.
468
+
469
+ <a id="shared-wording-22"></a>
470
+ Validation kind: `author`. Error code: `SQL_OPERATOR_TYPE_MISMATCH`.
471
+
472
+ Example names for OPTION member comparison: equal: [shared wording](#shared-wording-4).
473
+
474
+ ```sql
475
+ SELECT COUNT(*) AS n FROM "perf_orders_10k" WHERE ("状态").name = '状态1';
476
+ ```
477
+
478
+ ### OPTION member comparison: in
479
+
480
+ Guidance for OPTION member comparison: in: [shared wording](#shared-wording-20).
481
+
482
+ Preconditions for OPTION member comparison: in: [shared wording](#shared-wording-21).
483
+
484
+ Validation kind for OPTION member comparison: in: [shared wording](#shared-wording-22).
485
+
486
+ Example names for OPTION member comparison: in: [shared wording](#shared-wording-4).
487
+
488
+ ```sql
489
+ SELECT COUNT(*) AS n FROM "perf_orders_10k" WHERE ("状态").name IN ('状态1','状态2');
490
+ ```
491
+
492
+ ### OPTION member comparison: not in
493
+
494
+ Guidance for OPTION member comparison: not in: [shared wording](#shared-wording-20).
495
+
496
+ Preconditions for OPTION member comparison: not in: [shared wording](#shared-wording-21).
497
+
498
+ Validation kind for OPTION member comparison: not in: [shared wording](#shared-wording-22).
499
+
500
+ Example names for OPTION member comparison: not in: [shared wording](#shared-wording-4).
501
+
502
+ ```sql
503
+ SELECT COUNT(*) AS n FROM "perf_orders_10k" WHERE ("状态").name NOT IN ('状态1','状态2');
504
+ ```
505
+
506
+ ### OPTION member comparison: any
507
+
508
+ Guidance for OPTION member comparison: any: [shared wording](#shared-wording-20).
509
+
510
+ Preconditions for OPTION member comparison: any: [shared wording](#shared-wording-21).
511
+
512
+ Validation kind for OPTION member comparison: any: [shared wording](#shared-wording-22).
513
+
514
+ Example names for OPTION member comparison: any: [shared wording](#shared-wording-4).
515
+
516
+ ```sql
517
+ SELECT COUNT(*) AS n FROM "perf_orders_10k" WHERE ("状态").name = ANY(ARRAY['状态1','状态2']);
518
+ ```
519
+
520
+ ### OPTION member comparison: unnest equal
521
+
522
+ Guidance for OPTION member comparison: unnest equal: [shared wording](#shared-wording-20).
523
+
524
+ Preconditions for OPTION member comparison: unnest equal: [shared wording](#shared-wording-21).
525
+
526
+ Validation kind for OPTION member comparison: unnest equal: [shared wording](#shared-wording-22).
527
+
528
+ Example names for OPTION member comparison: unnest equal: [shared wording](#shared-wording-4).
529
+
530
+ ```sql
531
+ SELECT COUNT(*) AS n FROM "perf_orders_10k", UNNEST("标签") AS u WHERE u.name = '标签1';
532
+ ```
533
+
534
+ ### OPTION member comparison: parameter equal
535
+
536
+ Guidance for OPTION member comparison: parameter equal: [shared wording](#shared-wording-20).
537
+
538
+ Preconditions for OPTION member comparison: parameter equal: [shared wording](#shared-wording-21).
539
+
540
+ <a id="shared-wording-23"></a>
541
+ Validation kind: `author`. Error code: `SQL_PARAMETER_TYPE_MISMATCH`.
542
+
543
+ Example names for OPTION member comparison: parameter equal: [shared wording](#shared-wording-4).
544
+
545
+ ```sql
546
+ SELECT COUNT(*) AS n FROM "perf_orders_10k" WHERE ("状态").name = $1;
547
+ ```
548
+
549
+ ### OPTION member comparison: any parameter
550
+
551
+ Guidance for OPTION member comparison: any parameter: [shared wording](#shared-wording-20).
552
+
553
+ Preconditions for OPTION member comparison: any parameter: [shared wording](#shared-wording-21).
554
+
555
+ Validation kind: `author`. Error code: `SQL_FUNCTION_ARG_TYPE_MISMATCH`.
556
+
557
+ Example names for OPTION member comparison: any parameter: [shared wording](#shared-wording-4).
558
+
559
+ ```sql
560
+ SELECT COUNT(*) AS n FROM "perf_orders_10k" WHERE ("状态").name = ANY($1);
561
+ ```
562
+
563
+ ### OPTION member comparison: parameter id
564
+
565
+ Guidance for OPTION member comparison: parameter id: [shared wording](#shared-wording-20).
566
+
567
+ Preconditions for OPTION member comparison: parameter id: [shared wording](#shared-wording-21).
568
+
569
+ Validation kind for OPTION member comparison: parameter id: [shared wording](#shared-wording-23).
570
+
571
+ Example names for OPTION member comparison: parameter id: [shared wording](#shared-wording-4).
572
+
573
+ ```sql
574
+ SELECT COUNT(*) AS n FROM "perf_orders_10k" WHERE ("状态").id = $1;
575
+ ```
576
+
577
+ ### OPTION member comparison: collection contains
578
+
579
+ <a id="shared-wording-24"></a>
580
+ Where supported by this Base, project .name for labels or .id for option IDs with ARRAY_AGG over UNNEST, then compare the resulting TEXT[].
581
+
582
+ <a id="shared-wording-25"></a>
583
+ Preconditions: Author correction only: choose .name for option labels or .id for option IDs and supply matching text operands. This Base must support the member operation and the chosen predicate; target-capability rejection remains unchanged on older Bases. Group member values by record ID and join one projected row per source record. Preserve NULL collections separately from empty collections. ARRAY_REMOVE of a constant singleton constructs an empty TEXT array.
584
+
585
+ Validation kind for OPTION member comparison: collection contains: [shared wording](#shared-wording-22).
586
+
587
+ Example names for OPTION member comparison: collection contains: [shared wording](#shared-wording-4).
588
+
589
+ ```sql
590
+ WITH option_names AS (SELECT option_source.rec_id AS option_names_record_id, array_agg(option_item.name) AS option_names_members FROM perf_orders_10k option_source, unnest(option_source."标签") option_item GROUP BY option_source.rec_id) SELECT count(*) AS n FROM perf_orders_10k LEFT JOIN option_names ON perf_orders_10k.rec_id = option_names.option_names_record_id WHERE CASE WHEN perf_orders_10k."标签" IS NULL THEN NULL ELSE COALESCE(option_names.option_names_members, array_remove(ARRAY[''], '')) END @> ARRAY['标签1', '标签2'];
591
+ ```
592
+
593
+ ### OPTION member comparison: collection overlaps
594
+
595
+ Guidance for OPTION member comparison: collection overlaps: [shared wording](#shared-wording-24).
596
+
597
+ Preconditions for OPTION member comparison: collection overlaps: [shared wording](#shared-wording-25).
598
+
599
+ Validation kind for OPTION member comparison: collection overlaps: [shared wording](#shared-wording-22).
600
+
601
+ Example names for OPTION member comparison: collection overlaps: [shared wording](#shared-wording-4).
602
+
603
+ ```sql
604
+ WITH option_names AS (SELECT option_source.rec_id AS option_names_record_id, array_agg(option_item.name) AS option_names_members FROM perf_orders_10k option_source, unnest(option_source."标签") option_item GROUP BY option_source.rec_id) SELECT count(*) AS n FROM perf_orders_10k LEFT JOIN option_names ON perf_orders_10k.rec_id = option_names.option_names_record_id WHERE CASE WHEN perf_orders_10k."标签" IS NULL THEN NULL ELSE COALESCE(option_names.option_names_members, array_remove(ARRAY[''], '')) END && ARRAY['标签1', '标签2'];
605
+ ```
606
+
607
+ ### OPTION member comparison: collection contained
608
+
609
+ Guidance for OPTION member comparison: collection contained: [shared wording](#shared-wording-24).
610
+
611
+ Preconditions for OPTION member comparison: collection contained: [shared wording](#shared-wording-25).
612
+
613
+ Validation kind for OPTION member comparison: collection contained: [shared wording](#shared-wording-22).
614
+
615
+ Example names for OPTION member comparison: collection contained: [shared wording](#shared-wording-4).
616
+
617
+ ```sql
618
+ WITH option_names AS (SELECT option_source.rec_id AS option_names_record_id, array_agg(option_item.name) AS option_names_members FROM perf_orders_10k option_source, unnest(option_source."标签") option_item GROUP BY option_source.rec_id) SELECT count(*) AS n FROM perf_orders_10k LEFT JOIN option_names ON perf_orders_10k.rec_id = option_names.option_names_record_id WHERE CASE WHEN perf_orders_10k."标签" IS NULL THEN NULL ELSE COALESCE(option_names.option_names_members, array_remove(ARRAY[''], '')) END <@ ARRAY['标签1', '标签2'];
619
+ ```
620
+
621
+ ### OPTION member comparison: collection contains parameter
622
+
623
+ Guidance for OPTION member comparison: collection contains parameter: [shared wording](#shared-wording-24).
624
+
625
+ Preconditions for OPTION member comparison: collection contains parameter: [shared wording](#shared-wording-25).
626
+
627
+ Validation kind for OPTION member comparison: collection contains parameter: [shared wording](#shared-wording-23).
628
+
629
+ Example names for OPTION member comparison: collection contains parameter: [shared wording](#shared-wording-4).
630
+
631
+ ```sql
632
+ WITH option_names AS (SELECT option_source.rec_id AS option_names_record_id, array_agg(option_item.name) AS option_names_members FROM perf_orders_10k option_source, unnest(option_source."标签") option_item GROUP BY option_source.rec_id) SELECT count(*) AS n FROM perf_orders_10k LEFT JOIN option_names ON perf_orders_10k.rec_id = option_names.option_names_record_id WHERE CASE WHEN perf_orders_10k."标签" IS NULL THEN NULL ELSE COALESCE(option_names.option_names_members, array_remove(ARRAY[''], '')) END @> $1;
633
+ ```
634
+
635
+ ### OPTION member comparison: collection overlaps parameter
636
+
637
+ Guidance for OPTION member comparison: collection overlaps parameter: [shared wording](#shared-wording-24).
638
+
639
+ Preconditions for OPTION member comparison: collection overlaps parameter: [shared wording](#shared-wording-25).
640
+
641
+ Validation kind for OPTION member comparison: collection overlaps parameter: [shared wording](#shared-wording-23).
642
+
643
+ Example names for OPTION member comparison: collection overlaps parameter: [shared wording](#shared-wording-4).
644
+
645
+ ```sql
646
+ WITH option_names AS (SELECT option_source.rec_id AS option_names_record_id, array_agg(option_item.name) AS option_names_members FROM perf_orders_10k option_source, unnest(option_source."标签") option_item GROUP BY option_source.rec_id) SELECT count(*) AS n FROM perf_orders_10k LEFT JOIN option_names ON perf_orders_10k.rec_id = option_names.option_names_record_id WHERE CASE WHEN perf_orders_10k."标签" IS NULL THEN NULL ELSE COALESCE(option_names.option_names_members, array_remove(ARRAY[''], '')) END && $1;
647
+ ```
648
+
649
+ ## Placeholder reference
233
650
 
234
651
  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
652
 
236
653
  | Code / variant | Reason | Repair |
237
654
  |---|---|---|
238
655
  | `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] |
656
+ | `SQL_FUNCTION_NOT_FOUND` / `known_unavailable` | Function {Function} is not supported. | With INT/DOUBLE/TEXT values, a full partition and unique order: {Alternative} |
240
657
  | `SQL_FUNCTION_NOT_FOUND` / `unsupported_function` | Function {Function} is not supported. | [outside_sql] |
241
658
  | `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
659
  | `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
660
  | `SQL_INTERVAL_LITERAL_UNIT_NOT_SUPPORTED` / `interval_unit` | Interval unit {Unit} is not supported. | Use day, hour, minute, second, or millisecond units. |
661
+ | `SQL_TARGET_CAPABILITY_UNAVAILABLE` / `engine_version_required` | This SQL syntax is not supported for this Base yet. | Do not rewrite or retry the SQL; it becomes available after this Base is upgraded. |
662
+ | `SQL_TARGET_CAPABILITY_UNAVAILABLE` / `target_rewrite_available` | "{Capability}" is not supported for this Base yet. | {Rewrite} |
663
+ | `SQL_TARGET_CAPABILITY_UNAVAILABLE` / `target_upgrade_required` | "{Capability}" is not supported for this Base yet. | Do not rewrite or retry the SQL; it becomes available after this Base is upgraded. |
244
664
  | `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
665
  | `SQL_UNSUPPORTED_OPERATOR` / `unavailable_operation` | This {Operation} is not supported. | [outside_sql] |
246
666
  | `SQL_UNSUPPORTED_OPERATOR` / `unsupported_field_operator` | Column {Column} has type {ActualType}, which does not support {Operator}. | [outside_sql] |
@@ -251,6 +671,7 @@ Placeholders denote the names and types reported in the error. Use the concrete
251
671
  | `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
672
  | `SQL_UNSUPPORTED_SYNTAX` / `binary_operator` | Unsupported binary operator: {Operator}. | [outside_sql] |
253
673
  | `SQL_UNSUPPORTED_SYNTAX` / `capability_budget` | The supported limit was exceeded: {Dimension}. | Reduce this query dimension or split the operation into separate queries. |
674
+ | `SQL_UNSUPPORTED_SYNTAX` / `cast_target_name` | CAST target type {Target} is not supported. | [outside_sql] |
254
675
  | `SQL_UNSUPPORTED_SYNTAX` / `correlated_exists` | Correlated EXISTS does not support {Predicate}. | Only supported equality correlations can be expressed in SQL. [outside_sql] |
255
676
  | `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
677
  | `SQL_UNSUPPORTED_SYNTAX` / `date_trunc_context` | DATE_TRUNC output cannot be used in {Context}. | [outside_sql] |
@@ -263,9 +684,15 @@ Placeholders denote the names and types reported in the error. Use the concrete
263
684
  | `SQL_UNSUPPORTED_SYNTAX` / `named_window_reference` | Window definition {Window} is missing or duplicated. | Use a unique WINDOW definition and reference its declared name. |
264
685
  | `SQL_UNSUPPORTED_SYNTAX` / `nested_cte` | A nested CTE is not supported in {Context}. | [outside_sql] |
265
686
  | `SQL_UNSUPPORTED_SYNTAX` / `null_ordering` | Explicit NULLS ordering requires {Constraint}. | [outside_sql] |
687
+ | `SQL_UNSUPPORTED_SYNTAX` / `nullable_array_elements` | Arrays mixing column expressions and NULL require deterministic TEXT, INT, DOUBLE, BOOL, TIMESTAMP, or INTERVAL values. | [outside_sql] |
688
+ | `SQL_UNSUPPORTED_SYNTAX` / `nullable_array_predicate` | A predicate comparing column-based arrays containing NULL requires a search input with known non-null elements. | [outside_sql] |
689
+ | `SQL_UNSUPPORTED_SYNTAX` / `object_array_column_alias` | UNNEST column aliases support a single scalar array, not composite values or record references. | [outside_sql] |
690
+ | `SQL_UNSUPPORTED_SYNTAX` / `object_array_ordinality` | WITH ORDINALITY is not supported for arrays of composite values or record references. | [outside_sql] |
266
691
  | `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] |
692
+ | `SQL_UNSUPPORTED_SYNTAX` / `ordered_set_function` | Function {Function} does not support WITHIN GROUP. | [outside_sql] |
267
693
  | `SQL_UNSUPPORTED_SYNTAX` / `protocol_shape` | Invalid compiled structure: {Shape} is not supported. | Recompile the query using the current supported contract. |
268
694
  | `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] |
695
+ | `SQL_UNSUPPORTED_SYNTAX` / `series_shape` | GENERATE_SERIES supports constant integer bounds and a nonzero step, with at most 10000 values in the exact numeric range. | [outside_sql] |
269
696
  | `SQL_UNSUPPORTED_SYNTAX` / `subquery_constraint` | {Construct} requires {Constraint}. | The subquery must satisfy the stated constraint for a supported SQL rewrite. [outside_sql] |
270
697
  | `SQL_UNSUPPORTED_SYNTAX` / `syntax_feature` | SQL feature {Feature} is not supported. | [outside_sql] |
271
698
  | `SQL_UNSUPPORTED_SYNTAX` / `syntax_restriction` | {Restriction}. | [outside_sql] |
@@ -273,12 +700,12 @@ Placeholders denote the names and types reported in the error. Use the concrete
273
700
  | `SQL_UNSUPPORTED_SYNTAX` / `unary_operator` | Unsupported unary operator: {Operator}. | [outside_sql] |
274
701
  | `SQL_UNSUPPORTED_SYNTAX` / `unavailable_function_syntax` | Function {Function} is not supported. | [outside_sql] |
275
702
  | `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
703
  | `SQL_UNSUPPORTED_SYNTAX_EXCEPT` / `except_set` | EXCEPT {Quantifier} is not supported. | Duplicate and NULL behavior must be preserved. [outside_sql] |
278
704
  | `SQL_UNSUPPORTED_SYNTAX_INTERSECT` / `intersect_set` | INTERSECT {Quantifier} is not supported. | Duplicate and NULL behavior must be preserved. [outside_sql] |
279
705
  | `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
706
  | `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] |
707
+ | `SQL_UNSUPPORTED_SYNTAX_NULL_IN_LIST` / `null_in_list` | An explicit NULL element in an IN list is not supported. | Direct WHERE/HAVING/JOIN ON: remove NULL items; use FALSE if empty. Adding OR x IS NULL changes intent to include NULL rows. Not equivalent under NOT or in projection. |
708
+ | `SQL_UNSUPPORTED_SYNTAX_NULL_IN_LIST` / `null_not_in_list` | An explicit NULL element in a NOT IN list is not supported. | Direct filters: FALSE preserves no matches. To change intent, use x NOT IN (...) AND x IS NOT NULL, or x IS NOT NULL for an empty remaining list. Neither works under NOT or in projection. |
282
709
  | `SQL_UNSUPPORTED_SYNTAX_RECURSIVE_CTE` / `recursive_cte` | Recursive CTE {CTE} is not supported. | [outside_sql] |
283
710
  | `SQL_UNSUPPORTED_SYNTAX_REGEXP_REPLACE` / `regexp_replacement` | The requested replacement mode is not supported: {Mode}. | [outside_sql] |
284
711
  | `SQL_UNSUPPORTED_SYNTAX_WINDOW_FRAME` / `window_frame` | The window specification is not supported: {Frame}. | Changing the frame can change the result. [outside_sql] |
@@ -293,6 +720,7 @@ Placeholders denote the names and types reported in the error. Use the concrete
293
720
  | `ArrayConstructor` | `outside_sql` | This ANY operand requires an ARRAY constructor | [outside_sql] |
294
721
  | `ArrayDimension` | `outside_sql` | ARRAY_LENGTH requires literal 1 as the dimension | [outside_sql] |
295
722
  | `ArrayLengthArity` | `outside_sql` | Use ARRAY_LENGTH(array, 1) or CARDINALITY(array) | [outside_sql] |
723
+ | `ArraySortDomain` | `outside_sql` | ARRAY_SORT requires a one-dimensional literal array constructor or native collection field with proven non-NULL scalar elements, or a typed NULL array; parameters and derived array carriers are not supported | [outside_sql] |
296
724
  | `ArraySubquery` | `outside_sql` | ANY array operands and elements cannot contain subqueries | [outside_sql] |
297
725
  | `ArrayTypeModifier` | `outside_sql` | An empty ANY array requires an unmodified supported scalar array type | [outside_sql] |
298
726
  | `BetweenBounds` | `outside_sql` | BETWEEN requires two bounds | [outside_sql] |
@@ -308,10 +736,12 @@ Placeholders denote the names and types reported in the error. Use the concrete
308
736
  | `ColumnReference` | `outside_sql` | This column reference form is not supported | [outside_sql] |
309
737
  | `ConstantMembership` | `outside_sql` | Constant membership requires literal SELECT or UNION leaves and literal boolean filters, without ordering or pagination | [outside_sql] |
310
738
  | `ConstantMembershipKey` | `outside_sql` | This constant membership key has no supported equivalent rewrite | [outside_sql] |
739
+ | `CorrelatedExtremaShape` | `outside_sql` | Correlated scalar MIN/MAX requires an ungrouped outer query, one inner table, one aggregated column and a single equality between scalar columns in the current scopes; extra clauses are not supported | [outside_sql] |
311
740
  | `CorrelatedMembership` | `outside_sql` | Correlated membership requires equality column predicates between one inner source and current outer sources | [outside_sql] |
312
741
  | `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. |
742
+ | `CovarianceExactness` | `outside_sql` | Covariance and correlation are unavailable because equivalent floating-point results cannot be guaranteed | [outside_sql] |
313
743
  | `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] |
744
+ | `DistinctGrouping` | `outside_sql` | GROUP BY DISTINCT grouping sets require one source, direct unambiguous field keys, and an aggregate for the empty grouping set | [outside_sql] |
315
745
  | `DistinctOnNullOrdering` | `outside_sql` | DISTINCT ON with explicit NULLS ordering is not supported | [outside_sql] |
316
746
  | `DistinctOnPrefix` | `outside_sql` | DISTINCT ON expressions must match the leftmost ORDER BY expressions | [outside_sql] |
317
747
  | `DistinctWithGroupingSets` | `outside_sql` | SELECT DISTINCT with GROUPING SETS is not supported | [outside_sql] |
@@ -322,6 +752,7 @@ Placeholders denote the names and types reported in the error. Use the concrete
322
752
  | `ExpressionOperator` | `outside_sql` | This expression operator is not supported | [outside_sql] |
323
753
  | `ExtractForm` | `outside_sql` | Use EXTRACT(field FROM expression) | [outside_sql] |
324
754
  | `ExtremaOperator` | `outside_sql` | This LEAST or GREATEST operation is not supported | [outside_sql] |
755
+ | `FetchTiesShape` | `outside_sql` | FETCH WITH TIES requires ORDER BY and nonnegative constant row counts with explicit output columns | [outside_sql] |
325
756
  | `FromFunction` | `outside_sql` | FROM table functions require exactly one UNNEST call | [outside_sql] |
326
757
  | `FromItem` | `outside_sql` | This FROM item is not supported | [outside_sql] |
327
758
  | `FullJoinUsing` | `outside_sql` | FULL JOIN USING is not supported; use FULL JOIN ON and project COALESCE(left_key, right_key) | [outside_sql] |
@@ -329,12 +760,13 @@ Placeholders denote the names and types reported in the error. Use the concrete
329
760
  | `FunctionQualification` | `outside_sql` | Schema-qualified function names are not supported | [outside_sql] |
330
761
  | `GroupingField` | `outside_sql` | Grouping-set keys must be direct field references | [outside_sql] |
331
762
  | `GroupingKeyType` | `outside_sql` | DISTINCT grouping-set keys must be TEXT or DOUBLE fields | [outside_sql] |
763
+ | `GroupingMaskShape` | `outside_sql` | GROUPING requires direct mask projections, 1 to 31 direct grouping keys, an aggregate projection and at most 32 grouping branches; HAVING and DISTINCT are not supported | [outside_sql] |
332
764
  | `HavingAggregateMath` | `outside_sql` | Math over aggregates in HAVING requires a grouped subquery; compute the aggregate then filter its output with WHERE | [outside_sql] |
333
765
  | `HavingRewrite` | `outside_sql` | This HAVING expression has no supported equivalent subquery rewrite | [outside_sql] |
334
766
  | `HavingSubquery` | `outside_sql` | HAVING subqueries require ordinary GROUP BY, no CTE or window, and output-name or ordinal ordering | [outside_sql] |
335
767
  | `JoinAliases` | `outside_sql` | JOIN aliases, NATURAL JOIN, and JOIN USING aliases are not supported | [outside_sql] |
336
768
  | `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] |
769
+ | `JoinMembership` | `outside_sql` | JOIN membership requires inner-only joins or a two-source LEFT JOIN with qualified side-local predicates; LEFT JOIN also requires explicit column references without wildcards or scalar subqueries | [outside_sql] |
338
770
  | `JoinNesting` | `outside_sql` | Right-nested or aliased JOIN groups are not supported | [outside_sql] |
339
771
  | `JoinUsingName` | `outside_sql` | JOIN USING requires valid column names | [outside_sql] |
340
772
  | `LiteralKind` | `outside_sql` | This literal form is not supported | [outside_sql] |
@@ -345,21 +777,31 @@ Placeholders denote the names and types reported in the error. Use the concrete
345
777
  | `MembershipOperand` | `outside_sql` | A membership operand must be a column, literal, or parameter | [outside_sql] |
346
778
  | `MembershipSource` | `outside_sql` | This membership source requires a FROM relation | [outside_sql] |
347
779
  | `MixedOuterJoin` | `outside_sql` | RIGHT or FULL JOIN cannot be mixed with comma-separated FROM groups; use one explicit JOIN chain | [outside_sql] |
780
+ | `NaturalInnerShape` | `outside_sql` | NATURAL INNER JOIN requires exactly two physical tables with unique common scalar column names and matching types | [outside_sql] |
348
781
  | `NestedMembership` | `outside_sql` | A membership operand cannot contain nested subqueries | [outside_sql] |
349
782
  | `NestedScalar` | `outside_sql` | Nested scalar subquery operands are not supported | [outside_sql] |
783
+ | `NestedWindowShape` | `outside_sql` | Aggregate windows require a single grouping level and aggregate or grouping-column inputs | [outside_sql] |
350
784
  | `NotArity` | `outside_sql` | NOT requires one operand | [outside_sql] |
351
785
  | `NthValueArity` | `outside_sql` | NTH_VALUE requires two arguments | [outside_sql] |
352
786
  | `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] |
787
+ | `NumericTextDomain` | `outside_sql` | Numeric to TEXT conversion requires an integer literal with an optional sign in the range [-999999999999999, 999999999999999] | [outside_sql] |
353
788
  | `ObjectMember` | `outside_sql` | Object member access requires exactly one field in the form (expression).field | [outside_sql] |
354
789
  | `ObjectSubscript` | `outside_sql` | Array subscripts and empty object member names are not supported | [outside_sql] |
355
790
  | `OperatorMissing` | `outside_sql` | An operator name is required | [outside_sql] |
356
791
  | `OrderItem` | `outside_sql` | This ORDER BY item is not supported | [outside_sql] |
357
792
  | `OrderUsing` | `outside_sql` | ORDER BY USING is not supported | [outside_sql] |
793
+ | `OrderedArrayDomain` | `outside_sql` | Ordered ARRAY_AGG requires a provably non-NULL TEXT or numeric input, direct sort keys and a direct aggregate projection; DISTINCT, FILTER, windows and grouping sets are not supported | [outside_sql] |
794
+ | `OrderedStringAggregateShape` | `outside_sql` | Ordered STRING_AGG supports direct aggregate projections and grouping columns, TEXT input, a literal non-NULL separator and at most 32 direct sort keys; HAVING, DISTINCT, FILTER, windows and grouping sets are not supported | [outside_sql] |
795
+ | `PercentileDomain` | `outside_sql` | PERCENTILE_CONT requires a constant fraction between 0 and 1 and one numeric ordering expression; DISTINCT, FILTER and windows are not supported | [outside_sql] |
796
+ | `PowerExactDomain` | `outside_sql` | POWER requires a safe integer double precision literal of zero or a signed power of two, an integer exponent from -16 to 16, and safe integer products; negative exponents require a nonzero base | [outside_sql] |
358
797
  | `RecursiveShape` | `outside_sql` | A recursive CTE requires UNION or UNION ALL between its anchor and recursive term | [outside_sql] |
798
+ | `RegexLiteralForm` | `outside_sql` | Regular expressions require a nonempty literal pattern without metacharacters and a literal global replacement, or a literal SIMILAR TO prefix | [outside_sql] |
799
+ | `RowEqualityShape` | `outside_sql` | Row equality requires matching rows of 2 to 8 scalar elements and at most 32 IN alternatives; only columns, parameters, literals and deterministic arithmetic are supported | [outside_sql] |
359
800
  | `RowKeyType` | `outside_sql` | Row IN requires TEXT or DOUBLE keys; NOT IN also requires non-null keys on both sides | [outside_sql] |
360
801
  | `RowLock` | `outside_sql` | SELECT row locking is not supported | [outside_sql] |
361
802
  | `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
803
  | `ScalarAggregateOperand` | `outside_sql` | Scalar subquery operands require a single uncorrelated COUNT, SUM, AVG, MIN, or MAX in a non-grouped context | [outside_sql] |
804
+ | `ScalarLateralShape` | `outside_sql` | Scalar LATERAL requires a CROSS JOIN with deterministic single-row projections and no source, filter, grouping, ordering or row limit | [outside_sql] |
363
805
  | `SelectClause` | `outside_sql` | This SELECT clause is not supported | [outside_sql] |
364
806
  | `SelectOnly` | `outside_sql` | Only SELECT statements are supported | [outside_sql] |
365
807
  | `SelectRelation` | `outside_sql` | A CTE or derived relation must contain SELECT | [outside_sql] |
@@ -371,6 +813,8 @@ Placeholders denote the names and types reported in the error. Use the concrete
371
813
  | `StarJoinUsing` | `outside_sql` | SELECT * with JOIN USING requires explicit columns or a qualified alias.* | [outside_sql] |
372
814
  | `StarQualification` | `outside_sql` | Use * or table_alias.* for a star projection | [outside_sql] |
373
815
  | `StarUnnest` | `outside_sql` | Select the UNNEST alias explicitly instead of a star projection | [outside_sql] |
816
+ | `StaticAllForm` | `outside_sql` | ALL requires at most 32 same-type integer, text or Boolean literals, optional NULL elements, and a column or literal left operand | [outside_sql] |
817
+ | `StaticArrayForm` | `outside_sql` | Array operations require matching integer, text or Boolean literal arrays of at most 32 elements, without NULL elements, and literal indexes | [outside_sql] |
374
818
  | `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
819
  | `StringAggregationSeparator` | `outside_sql` | STRING_AGG requires an ASCII separator without a zero byte | Replacing the requested separator would change the result. [outside_sql] |
376
820
  | `SubqueryForm` | `outside_sql` | This subquery form is not supported | [outside_sql] |
@@ -379,16 +823,17 @@ Placeholders denote the names and types reported in the error. Use the concrete
379
823
  | `TableQualification` | `outside_sql` | Schema-qualified table names are not supported | [outside_sql] |
380
824
  | `TemporalLiteral` | `outside_sql` | Only TIMESTAMP and INTERVAL typed literals are supported | [outside_sql] |
381
825
  | `TextPosition` | `outside_sql` | Character-based text position functions are not supported | [outside_sql] |
826
+ | `TranslateLiteralMap` | `outside_sql` | TRANSLATE requires literal equal-length Unicode mappings without duplicate or overlapping characters | [outside_sql] |
382
827
  | `TrimCharacters` | `outside_sql` | TRIM with PostgreSQL character semantics is not supported | Changing the trim spelling does not enable this operation. [outside_sql] |
828
+ | `TruncFiniteDomain` | `outside_sql` | TRUNC requires a finite double precision literal with magnitude at most 9007199254740991, excluding negative zero and values between -1 and 0 | [outside_sql] |
383
829
  | `TypeName` | `outside_sql` | This type name is not supported | [outside_sql] |
384
830
  | `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] |
831
+ | `UnnestForm` | `outside_sql` | UNNEST ROWS FROM, column definitions, and excess column aliases are not supported | [outside_sql] |
386
832
  | `ValueFunction` | `outside_sql` | This SQL value function is not supported | [outside_sql] |
387
833
  | `ValueMemberKey` | `outside_sql` | Value membership requires TEXT or DOUBLE keys; computed INT keys are not supported | [outside_sql] |
388
834
  | `ValueSubqueryType` | `outside_sql` | Value subqueries require scalar numeric or TEXT operands without outer aggregates or windows | [outside_sql] |
389
835
  | `WindowInheritance` | `outside_sql` | A window cannot copy a frame or override inherited PARTITION BY or ORDER BY | [outside_sql] |
390
836
  | `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
837
 
393
838
  ## Rewrites that must not be substituted
394
839
 
@@ -398,6 +843,3 @@ Placeholders denote the names and types reported in the error. Use the concrete
398
843
  - `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
844
  - `SQL_UNSUPPORTED_SYNTAX`: Adding an arbitrary FROM relation changes row count, including on empty input. Adding an arbitrary table can change row count.
400
845
  - `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.