@lark-base-open/base-database-cli 1.3.7 → 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.
- package/CHANGELOG.md +42 -0
- package/README.md +2 -0
- package/dist/ai-functions.d.ts +11 -0
- package/dist/ai-functions.d.ts.map +1 -1
- package/dist/ai-functions.js +118 -9
- package/dist/ai-functions.js.map +1 -1
- package/dist/archive.d.ts +16 -2
- package/dist/archive.d.ts.map +1 -1
- package/dist/archive.js +63 -13
- package/dist/archive.js.map +1 -1
- package/dist/deploy.d.ts +4 -0
- package/dist/deploy.d.ts.map +1 -1
- package/dist/deploy.js +26 -8
- package/dist/deploy.js.map +1 -1
- package/dist/function-description.d.ts +6 -0
- package/dist/function-description.d.ts.map +1 -0
- package/dist/function-description.js +29 -0
- package/dist/function-description.js.map +1 -0
- package/dist/init.d.ts +1 -1
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +4 -3
- package/dist/init.js.map +1 -1
- package/dist/lark-cli-error.d.ts +2 -0
- package/dist/lark-cli-error.d.ts.map +1 -1
- package/dist/lark-cli-error.js +42 -7
- package/dist/lark-cli-error.js.map +1 -1
- package/dist/lark-cli.d.ts.map +1 -1
- package/dist/lark-cli.js +16 -4
- package/dist/lark-cli.js.map +1 -1
- package/dist/mutation.d.ts +1 -1
- package/dist/mutation.d.ts.map +1 -1
- package/dist/mutation.js +5 -5
- package/dist/mutation.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +7 -2
- package/dist/program.js.map +1 -1
- package/dist/project-context.d.ts.map +1 -1
- package/dist/project-context.js +42 -6
- package/dist/project-context.js.map +1 -1
- package/dist/public-sql-error.d.ts.map +1 -1
- package/dist/public-sql-error.js +2 -18
- package/dist/public-sql-error.js.map +1 -1
- package/dist/pull.d.ts +1 -0
- package/dist/pull.d.ts.map +1 -1
- package/dist/pull.js +13 -0
- package/dist/pull.js.map +1 -1
- package/package.json +1 -1
- package/skills/lark-base-database/SKILL.md +32 -12
- package/skills/lark-base-database/references/ai-function.md +19 -7
- package/skills/lark-base-database/references/base-capability-routing.md +4 -4
- package/skills/lark-base-database/references/base-sql-errors.generated.md +845 -0
- package/skills/lark-base-database/references/database-function-limitations.md +20 -37
- package/skills/lark-base-database/references/database-function.md +39 -42
- package/skills/lark-base-database/references/development.md +4 -2
- package/skills/lark-base-database/references/faas.md +9 -7
- package/skills/lark-base-database/references/file-transfer.md +1 -1
- package/skills/lark-base-database/references/frontend-design-guide.md +163 -33
- package/skills/lark-base-database/references/mutations.md +4 -4
- package/skills/lark-base-database/references/notifications.md +9 -9
- package/skills/lark-base-database/references/release.md +10 -10
- package/skills/lark-base-database/references/style-guide.md +2 -2
- package/skills/lark-base-database/references/verification.md +6 -4
- package/skills/lark-base-database/references/workspace.md +15 -13
- package/templates/database-starter/gitignore +7 -0
- package/templates/database-starter/mutations/README.md +1 -1
- package/templates/database-starter/page/package-lock.json +4 -4
- package/templates/database-starter/page/package.json +1 -1
- 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 +140 -25
- package/templates/database-starter/page/src/components/floating-button/utils/request-edit.test.ts +42 -0
- package/templates/database-starter/page/src/components/floating-button/utils/request-edit.ts +21 -0
- package/templates/database-starter/page/src/main.test.ts +28 -0
- package/templates/database-starter/page/src/main.tsx +2 -0
- package/skills/lark-base-database/references/design/components/actions-fields.md +0 -16
- package/skills/lark-base-database/references/design/components/code/controls.css +0 -122
- package/skills/lark-base-database/references/design/components/code/controls.tsx +0 -73
- package/skills/lark-base-database/references/design/components/code/date-picker.tsx +0 -42
- package/skills/lark-base-database/references/design/components/code/floating.tsx +0 -41
- package/skills/lark-base-database/references/design/components/code/overlays.tsx +0 -19
- package/skills/lark-base-database/references/design/components/code/select.tsx +0 -34
- package/skills/lark-base-database/references/design/components/code/styles.d.ts +0 -1
- package/skills/lark-base-database/references/design/components/code/theme.css +0 -49
- package/skills/lark-base-database/references/design/components/code/usage.tsx +0 -38
- package/skills/lark-base-database/references/design/components/date-time-number.md +0 -9
- package/skills/lark-base-database/references/design/components/feedback-navigation.md +0 -9
- package/skills/lark-base-database/references/design/components/index.md +0 -18
- package/skills/lark-base-database/references/design/components/overlays.md +0 -9
- package/skills/lark-base-database/references/design/components/patterns/flat-business.md +0 -7
- package/skills/lark-base-database/references/design/components/selection.md +0 -24
- package/skills/lark-base-database/references/design/components.md +0 -91
- package/skills/lark-base-database/references/design/composition.md +0 -90
- package/skills/lark-base-database/references/design/control-recipes.md +0 -107
- package/skills/lark-base-database/references/design/examples.md +0 -172
- package/skills/lark-base-database/references/design/foundations.md +0 -126
- package/skills/lark-base-database/references/design/review.md +0 -82
- package/skills/lark-base-database/references/design/scenes/analysis-report.md +0 -66
- package/skills/lark-base-database/references/design/scenes/brand-showcase.md +0 -70
- package/skills/lark-base-database/references/design/scenes/business-operations.md +0 -85
- package/skills/lark-base-database/references/design/scenes/campaign-report.md +0 -66
- package/skills/lark-base-database/references/design/scenes/dashboard.md +0 -77
- package/skills/lark-base-database/references/design/scenes/festive-campaign.md +0 -69
- package/skills/lark-base-database/references/design/theme.md +0 -27
- package/skills/lark-base-database/references/design/typography.md +0 -56
|
@@ -0,0 +1,845 @@
|
|
|
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
|
+
### 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
|
+
|
|
83
|
+
### Division with a zero divisor
|
|
84
|
+
|
|
85
|
+
<a id="shared-wording-6"></a>
|
|
86
|
+
Use NULLIF(divisor, 0) as the divisor if a NULL result is acceptable.
|
|
87
|
+
|
|
88
|
+
Preconditions: The caller accepts NULL instead of a division-by-zero error.
|
|
89
|
+
|
|
90
|
+
<a id="shared-wording-7"></a>
|
|
91
|
+
Validation kind: `guard`. Error code: `SQL_DIVISION_BY_ZERO`.
|
|
92
|
+
|
|
93
|
+
Example names for Division with a zero divisor: [shared wording](#shared-wording-4).
|
|
94
|
+
|
|
95
|
+
```sql
|
|
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;
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Division with a nonzero divisor
|
|
100
|
+
|
|
101
|
+
Guidance for Division with a nonzero divisor: [shared wording](#shared-wording-6).
|
|
102
|
+
|
|
103
|
+
Preconditions: For a nonzero divisor the value must be unchanged.
|
|
104
|
+
|
|
105
|
+
Validation kind for Division with a nonzero divisor: [shared wording](#shared-wording-7).
|
|
106
|
+
|
|
107
|
+
Example names for Division with a nonzero divisor: [shared wording](#shared-wording-4).
|
|
108
|
+
|
|
109
|
+
```sql
|
|
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;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Filter a window output in a subquery
|
|
114
|
+
|
|
115
|
+
Compute the window in a SELECT subquery, then refer to its output.
|
|
116
|
+
|
|
117
|
+
Preconditions: Move the window output into a subquery before filtering; this corrects an invalid window context.
|
|
118
|
+
|
|
119
|
+
Validation kind: `author`. Error code: `SQL_WINDOW_NOT_ALLOWED`.
|
|
120
|
+
|
|
121
|
+
Example names for Filter a window output in a subquery: [shared wording](#shared-wording-4).
|
|
122
|
+
|
|
123
|
+
```sql
|
|
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;
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Use the PostgreSQL TO_CHAR spelling
|
|
128
|
+
|
|
129
|
+
Use the stated public SQL function and its documented signature.
|
|
130
|
+
|
|
131
|
+
Preconditions: Choose the intended PostgreSQL format; this example uses the full date and time format.
|
|
132
|
+
|
|
133
|
+
Validation kind: `author`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
|
|
134
|
+
|
|
135
|
+
Example names for Use the PostgreSQL TO_CHAR spelling: [shared wording](#shared-wording-4).
|
|
136
|
+
|
|
137
|
+
```sql
|
|
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;
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Give NULL an explicit public type
|
|
142
|
+
|
|
143
|
+
Use an explicit CAST with the intended public SQL type.
|
|
144
|
+
|
|
145
|
+
Preconditions: Choose the intended public type; the example chooses TEXT.
|
|
146
|
+
|
|
147
|
+
Validation kind: `author`. Error code: `SQL_UNTYPED_NULL`.
|
|
148
|
+
|
|
149
|
+
Example names for Give NULL an explicit public type: [shared wording](#shared-wording-4).
|
|
150
|
+
|
|
151
|
+
```sql
|
|
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;
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Correlated max join
|
|
156
|
+
|
|
157
|
+
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.
|
|
158
|
+
|
|
159
|
+
Preconditions: Equality to a correlated MAX grouped by the correlation key; preserve NULL keys and empty groups.
|
|
160
|
+
|
|
161
|
+
<a id="shared-wording-8"></a>
|
|
162
|
+
Validation kind: `equivalent`. Error code: `SQL_UNSUPPORTED_SYNTAX`.
|
|
163
|
+
|
|
164
|
+
Example names for Correlated max join: [shared wording](#shared-wording-4).
|
|
165
|
+
|
|
166
|
+
```sql
|
|
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;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Octet length bytes
|
|
171
|
+
|
|
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.
|
|
173
|
+
|
|
174
|
+
Preconditions: The intent is byte count, not character count. Applies to non-ASCII text and NULL inputs.
|
|
175
|
+
|
|
176
|
+
Validation kind for Octet length bytes: [shared wording](#shared-wording-3).
|
|
177
|
+
|
|
178
|
+
Example names for Octet length bytes: [shared wording](#shared-wording-4).
|
|
179
|
+
|
|
180
|
+
```sql
|
|
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;
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Array scalar containment
|
|
185
|
+
|
|
186
|
+
<a id="shared-wording-9"></a>
|
|
187
|
+
Both operands must be arrays of compatible element types. For single-value containment, wrap the scalar in a one-element array.
|
|
188
|
+
|
|
189
|
+
<a id="shared-wording-10"></a>
|
|
190
|
+
Preconditions: Single-value array containment is intended; include NULL input and unmatched elements.
|
|
191
|
+
|
|
192
|
+
<a id="shared-wording-11"></a>
|
|
193
|
+
Validation kind: `equivalent`. Error code: `SQL_OPERATOR_TYPE_MISMATCH`.
|
|
194
|
+
|
|
195
|
+
Example names for Array scalar containment: [shared wording](#shared-wording-4).
|
|
196
|
+
|
|
197
|
+
```sql
|
|
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;
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Array scalar contains
|
|
202
|
+
|
|
203
|
+
Guidance for Array scalar contains: [shared wording](#shared-wording-9).
|
|
204
|
+
|
|
205
|
+
Preconditions for Array scalar contains: [shared wording](#shared-wording-10).
|
|
206
|
+
|
|
207
|
+
Validation kind for Array scalar contains: [shared wording](#shared-wording-11).
|
|
208
|
+
|
|
209
|
+
Example names for Array scalar contains: [shared wording](#shared-wording-4).
|
|
210
|
+
|
|
211
|
+
```sql
|
|
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;
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Numeric predicate
|
|
216
|
+
|
|
217
|
+
Use a BOOL condition. If the intent is to exclude zero, compare the numeric expression with zero; NULL rows will not match.
|
|
218
|
+
|
|
219
|
+
Preconditions: The explicitly selected intent is to exclude numeric zero and NULL.
|
|
220
|
+
|
|
221
|
+
<a id="shared-wording-12"></a>
|
|
222
|
+
Validation kind: `author`. Error code: `SQL_WHERE_TYPE_MISMATCH`.
|
|
223
|
+
|
|
224
|
+
Example names for Numeric predicate: [shared wording](#shared-wording-4).
|
|
225
|
+
|
|
226
|
+
```sql
|
|
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;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Text predicate
|
|
231
|
+
|
|
232
|
+
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.
|
|
233
|
+
|
|
234
|
+
Preconditions: The explicitly selected intent is to exclude empty text and NULL.
|
|
235
|
+
|
|
236
|
+
Validation kind for Text predicate: [shared wording](#shared-wording-12).
|
|
237
|
+
|
|
238
|
+
Example names for Text predicate: [shared wording](#shared-wording-4).
|
|
239
|
+
|
|
240
|
+
```sql
|
|
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;
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Remainder nullif
|
|
245
|
+
|
|
246
|
+
<a id="shared-wording-13"></a>
|
|
247
|
+
Use NULLIF(divisor, 0) as the remainder divisor if a NULL result is acceptable.
|
|
248
|
+
|
|
249
|
+
Preconditions: Returning NULL instead of an error for a zero remainder divisor is acceptable.
|
|
250
|
+
|
|
251
|
+
Validation kind for Remainder nullif: [shared wording](#shared-wording-7).
|
|
252
|
+
|
|
253
|
+
Example names for Remainder nullif: [shared wording](#shared-wording-4).
|
|
254
|
+
|
|
255
|
+
```sql
|
|
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;
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Remainder nullif nonzero
|
|
260
|
+
|
|
261
|
+
Guidance for Remainder nullif nonzero: [shared wording](#shared-wording-13).
|
|
262
|
+
|
|
263
|
+
Preconditions: Integer-valued sort keys; verify that the guard preserves a nonzero divisor.
|
|
264
|
+
|
|
265
|
+
Validation kind for Remainder nullif nonzero: [shared wording](#shared-wording-7).
|
|
266
|
+
|
|
267
|
+
Example names for Remainder nullif nonzero: [shared wording](#shared-wording-4).
|
|
268
|
+
|
|
269
|
+
```sql
|
|
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;
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Cast int format
|
|
274
|
+
|
|
275
|
+
Use an optional sign and decimal digits for INT input, for example '123'. Supply the intended value; do not substitute the example.
|
|
276
|
+
|
|
277
|
+
Preconditions: The caller explicitly supplies the value 123; this example must not replace an unknown intended value.
|
|
278
|
+
|
|
279
|
+
<a id="shared-wording-14"></a>
|
|
280
|
+
Validation kind: `author`. Error code: `SQL_INVALID_CAST`.
|
|
281
|
+
|
|
282
|
+
Example names for Cast int format: [shared wording](#shared-wording-4).
|
|
283
|
+
|
|
284
|
+
```sql
|
|
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;
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Cast double format
|
|
289
|
+
|
|
290
|
+
Use a finite decimal number for DOUBLE input, for example '1.25'. Supply the intended value; do not substitute the example.
|
|
291
|
+
|
|
292
|
+
Preconditions: The caller explicitly supplies the finite decimal value 1.25.
|
|
293
|
+
|
|
294
|
+
Validation kind for Cast double format: [shared wording](#shared-wording-14).
|
|
295
|
+
|
|
296
|
+
Example names for Cast double format: [shared wording](#shared-wording-4).
|
|
297
|
+
|
|
298
|
+
```sql
|
|
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;
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Materialize option names before array construction
|
|
303
|
+
|
|
304
|
+
Compute OPTION.name in a derived table first, then construct ARRAY from that projected column. Preserve the original joins, filters, and NULL behavior.
|
|
305
|
+
|
|
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.
|
|
307
|
+
|
|
308
|
+
Validation kind for Materialize option names before array construction: [shared wording](#shared-wording-8).
|
|
309
|
+
|
|
310
|
+
Example names for Materialize option names before array construction: [shared wording](#shared-wording-4).
|
|
311
|
+
|
|
312
|
+
```sql
|
|
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;
|
|
314
|
+
```
|
|
315
|
+
|
|
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
|
|
650
|
+
|
|
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.
|
|
652
|
+
|
|
653
|
+
| Code / variant | Reason | Repair |
|
|
654
|
+
|---|---|---|
|
|
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] |
|
|
656
|
+
| `SQL_FUNCTION_NOT_FOUND` / `known_unavailable` | Function {Function} is not supported. | With INT/DOUBLE/TEXT values, a full partition and unique order: {Alternative} |
|
|
657
|
+
| `SQL_FUNCTION_NOT_FOUND` / `unsupported_function` | Function {Function} is not supported. | [outside_sql] |
|
|
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] |
|
|
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] |
|
|
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. |
|
|
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] |
|
|
665
|
+
| `SQL_UNSUPPORTED_OPERATOR` / `unavailable_operation` | This {Operation} is not supported. | [outside_sql] |
|
|
666
|
+
| `SQL_UNSUPPORTED_OPERATOR` / `unsupported_field_operator` | Column {Column} has type {ActualType}, which does not support {Operator}. | [outside_sql] |
|
|
667
|
+
| `SQL_UNSUPPORTED_OPERATOR` / `unsupported_operator` | Operator {Operator} is not supported for {ArgTypes}. | [outside_sql] |
|
|
668
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `aggregate_modifier` | Aggregate {Function} does not support {Modifier}. | [outside_sql] |
|
|
669
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `aggregate_separator` | The separator of {Function} must be {Requirement}. | [outside_sql] |
|
|
670
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `array_dimension` | ARRAY_LENGTH dimension must be {Form}. | Changing the dimension can change the result. [outside_sql] |
|
|
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] |
|
|
672
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `binary_operator` | Unsupported binary operator: {Operator}. | [outside_sql] |
|
|
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] |
|
|
675
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `correlated_exists` | Correlated EXISTS does not support {Predicate}. | Only supported equality correlations can be expressed in SQL. [outside_sql] |
|
|
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. |
|
|
677
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `date_trunc_context` | DATE_TRUNC output cannot be used in {Context}. | [outside_sql] |
|
|
678
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `date_trunc_unit` | DATE_TRUNC unit {Part} is not supported because it cannot preserve timestamp identity. | [outside_sql] |
|
|
679
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `function_input_types` | Function {Function} requires TEXT arguments; received {ArgTypes}. | Use TEXT inputs for this function. |
|
|
680
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `identity_operation` | Unsupported operation: {Constraint}. | Compare identities of the same kind or use separate TEXT parameters; do not transform identity values. |
|
|
681
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `identity_output` | Output {Output} combines identities with incompatible values. | Keep USER identities, CHAT identities, and plain text in separate outputs. |
|
|
682
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `identity_parameter` | Parameter {Parameter} violates this constraint: {Constraint}. | Use separate TEXT parameters for each identity namespace and for plain text. |
|
|
683
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `location_coordinate` | LOCATION member {Member} is not supported. | An address or complete object is not an equivalent result. [outside_sql] |
|
|
684
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `named_window_reference` | Window definition {Window} is missing or duplicated. | Use a unique WINDOW definition and reference its declared name. |
|
|
685
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `nested_cte` | A nested CTE is not supported in {Context}. | [outside_sql] |
|
|
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] |
|
|
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] |
|
|
693
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `protocol_shape` | Invalid compiled structure: {Shape} is not supported. | Recompile the query using the current supported contract. |
|
|
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] |
|
|
696
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `subquery_constraint` | {Construct} requires {Constraint}. | The subquery must satisfy the stated constraint for a supported SQL rewrite. [outside_sql] |
|
|
697
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `syntax_feature` | SQL feature {Feature} is not supported. | [outside_sql] |
|
|
698
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `syntax_restriction` | {Restriction}. | [outside_sql] |
|
|
699
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `type_representation` | The query cannot represent type {ActualType}. | [outside_sql] |
|
|
700
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `unary_operator` | Unsupported unary operator: {Operator}. | [outside_sql] |
|
|
701
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `unavailable_function_syntax` | Function {Function} is not supported. | [outside_sql] |
|
|
702
|
+
| `SQL_UNSUPPORTED_SYNTAX` / `window_capability` | Window function {Function} requires {Requirement}. | [outside_sql] |
|
|
703
|
+
| `SQL_UNSUPPORTED_SYNTAX_EXCEPT` / `except_set` | EXCEPT {Quantifier} is not supported. | Duplicate and NULL behavior must be preserved. [outside_sql] |
|
|
704
|
+
| `SQL_UNSUPPORTED_SYNTAX_INTERSECT` / `intersect_set` | INTERSECT {Quantifier} is not supported. | Duplicate and NULL behavior must be preserved. [outside_sql] |
|
|
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] |
|
|
706
|
+
| `SQL_UNSUPPORTED_SYNTAX_LATERAL` / `lateral_correlation` | LATERAL with {Correlation} is not supported. | [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. |
|
|
709
|
+
| `SQL_UNSUPPORTED_SYNTAX_RECURSIVE_CTE` / `recursive_cte` | Recursive CTE {CTE} is not supported. | [outside_sql] |
|
|
710
|
+
| `SQL_UNSUPPORTED_SYNTAX_REGEXP_REPLACE` / `regexp_replacement` | The requested replacement mode is not supported: {Mode}. | [outside_sql] |
|
|
711
|
+
| `SQL_UNSUPPORTED_SYNTAX_WINDOW_FRAME` / `window_frame` | The window specification is not supported: {Frame}. | Changing the frame can change the result. [outside_sql] |
|
|
712
|
+
|
|
713
|
+
## Syntax restriction repair policies
|
|
714
|
+
|
|
715
|
+
| Restriction | Policy | Reason | Repair |
|
|
716
|
+
|---|---|---|---|
|
|
717
|
+
| `AggregateCallForm` | `outside_sql` | This aggregate FILTER, ORDER BY, WITHIN GROUP, or variadic call form is not supported | [outside_sql] |
|
|
718
|
+
| `AggregateFilter` | `outside_sql` | FILTER requires an aggregate function | [outside_sql] |
|
|
719
|
+
| `AnyKeyType` | `outside_sql` | Expanded ANY arrays require numeric or TEXT operands | [outside_sql] |
|
|
720
|
+
| `ArrayConstructor` | `outside_sql` | This ANY operand requires an ARRAY constructor | [outside_sql] |
|
|
721
|
+
| `ArrayDimension` | `outside_sql` | ARRAY_LENGTH requires literal 1 as the dimension | [outside_sql] |
|
|
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] |
|
|
724
|
+
| `ArraySubquery` | `outside_sql` | ANY array operands and elements cannot contain subqueries | [outside_sql] |
|
|
725
|
+
| `ArrayTypeModifier` | `outside_sql` | An empty ANY array requires an unmodified supported scalar array type | [outside_sql] |
|
|
726
|
+
| `BetweenBounds` | `outside_sql` | BETWEEN requires two bounds | [outside_sql] |
|
|
727
|
+
| `BooleanOperands` | `outside_sql` | A boolean expression requires operands | [outside_sql] |
|
|
728
|
+
| `BooleanOperator` | `outside_sql` | This boolean operator is not supported | [outside_sql] |
|
|
729
|
+
| `CTESearchCycle` | `outside_sql` | CTE SEARCH and CYCLE are not supported | [outside_sql] |
|
|
730
|
+
| `CaseBranch` | `outside_sql` | A CASE WHEN branch is invalid | [outside_sql] |
|
|
731
|
+
| `CastModifier` | `outside_sql` | Cast targets with modifiers or explicit array bounds are not supported | [outside_sql] |
|
|
732
|
+
| `CastTargetMissing` | `outside_sql` | CAST requires a target type | [outside_sql] |
|
|
733
|
+
| `CastValueMissing` | `outside_sql` | CAST requires a value | [outside_sql] |
|
|
734
|
+
| `ColumnAlias` | `outside_sql` | Column aliases must be non-empty identifiers | [outside_sql] |
|
|
735
|
+
| `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] |
|
|
736
|
+
| `ColumnReference` | `outside_sql` | This column reference form is not supported | [outside_sql] |
|
|
737
|
+
| `ConstantMembership` | `outside_sql` | Constant membership requires literal SELECT or UNION leaves and literal boolean filters, without ordering or pagination | [outside_sql] |
|
|
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] |
|
|
740
|
+
| `CorrelatedMembership` | `outside_sql` | Correlated membership requires equality column predicates between one inner source and current outer sources | [outside_sql] |
|
|
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] |
|
|
743
|
+
| `CurrentDate` | `outside_sql` | CURRENT_DATE is not supported; use a TIMESTAMP value or CURRENT_TIMESTAMP when equivalent | [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] |
|
|
745
|
+
| `DistinctOnNullOrdering` | `outside_sql` | DISTINCT ON with explicit NULLS ordering is not supported | [outside_sql] |
|
|
746
|
+
| `DistinctOnPrefix` | `outside_sql` | DISTINCT ON expressions must match the leftmost ORDER BY expressions | [outside_sql] |
|
|
747
|
+
| `DistinctWithGroupingSets` | `outside_sql` | SELECT DISTINCT with GROUPING SETS is not supported | [outside_sql] |
|
|
748
|
+
| `EmptyProjection` | `outside_sql` | SELECT must produce at least one column | [outside_sql] |
|
|
749
|
+
| `EqualityAny` | `outside_sql` | Array ANY supports equality comparisons only | [outside_sql] |
|
|
750
|
+
| `ExpressionForm` | `outside_sql` | This expression form is not supported | [outside_sql] |
|
|
751
|
+
| `ExpressionList` | `outside_sql` | An expression list cannot be empty | [outside_sql] |
|
|
752
|
+
| `ExpressionOperator` | `outside_sql` | This expression operator is not supported | [outside_sql] |
|
|
753
|
+
| `ExtractForm` | `outside_sql` | Use EXTRACT(field FROM expression) | [outside_sql] |
|
|
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] |
|
|
756
|
+
| `FromFunction` | `outside_sql` | FROM table functions require exactly one UNNEST call | [outside_sql] |
|
|
757
|
+
| `FromItem` | `outside_sql` | This FROM item is not supported | [outside_sql] |
|
|
758
|
+
| `FullJoinUsing` | `outside_sql` | FULL JOIN USING is not supported; use FULL JOIN ON and project COALESCE(left_key, right_key) | [outside_sql] |
|
|
759
|
+
| `FullPartitionFrame` | `outside_sql` | LAST_VALUE requires an explicit full-partition frame | [outside_sql] |
|
|
760
|
+
| `FunctionQualification` | `outside_sql` | Schema-qualified function names are not supported | [outside_sql] |
|
|
761
|
+
| `GroupingField` | `outside_sql` | Grouping-set keys must be direct field references | [outside_sql] |
|
|
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] |
|
|
764
|
+
| `HavingAggregateMath` | `outside_sql` | Math over aggregates in HAVING requires a grouped subquery; compute the aggregate then filter its output with WHERE | [outside_sql] |
|
|
765
|
+
| `HavingRewrite` | `outside_sql` | This HAVING expression has no supported equivalent subquery rewrite | [outside_sql] |
|
|
766
|
+
| `HavingSubquery` | `outside_sql` | HAVING subqueries require ordinary GROUP BY, no CTE or window, and output-name or ordinal ordering | [outside_sql] |
|
|
767
|
+
| `JoinAliases` | `outside_sql` | JOIN aliases, NATURAL JOIN, and JOIN USING aliases are not supported | [outside_sql] |
|
|
768
|
+
| `JoinKind` | `outside_sql` | Only INNER, LEFT, RIGHT, FULL, and CROSS JOIN are supported | [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] |
|
|
770
|
+
| `JoinNesting` | `outside_sql` | Right-nested or aliased JOIN groups are not supported | [outside_sql] |
|
|
771
|
+
| `JoinUsingName` | `outside_sql` | JOIN USING requires valid column names | [outside_sql] |
|
|
772
|
+
| `LiteralKind` | `outside_sql` | This literal form is not supported | [outside_sql] |
|
|
773
|
+
| `MembershipArity` | `outside_sql` | A scalar membership expression requires one operand | [outside_sql] |
|
|
774
|
+
| `MembershipCTE` | `outside_sql` | Membership CTEs must be nonrecursive and have no column alias list or nested expression subquery | [outside_sql] |
|
|
775
|
+
| `MembershipComparison` | `outside_sql` | Subquery membership supports IN and equality ANY only | [outside_sql] |
|
|
776
|
+
| `MembershipKeyType` | `outside_sql` | Membership keys must be numeric or TEXT | [outside_sql] |
|
|
777
|
+
| `MembershipOperand` | `outside_sql` | A membership operand must be a column, literal, or parameter | [outside_sql] |
|
|
778
|
+
| `MembershipSource` | `outside_sql` | This membership source requires a FROM relation | [outside_sql] |
|
|
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] |
|
|
781
|
+
| `NestedMembership` | `outside_sql` | A membership operand cannot contain nested subqueries | [outside_sql] |
|
|
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] |
|
|
784
|
+
| `NotArity` | `outside_sql` | NOT requires one operand | [outside_sql] |
|
|
785
|
+
| `NthValueArity` | `outside_sql` | NTH_VALUE requires two arguments | [outside_sql] |
|
|
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] |
|
|
788
|
+
| `ObjectMember` | `outside_sql` | Object member access requires exactly one field in the form (expression).field | [outside_sql] |
|
|
789
|
+
| `ObjectSubscript` | `outside_sql` | Array subscripts and empty object member names are not supported | [outside_sql] |
|
|
790
|
+
| `OperatorMissing` | `outside_sql` | An operator name is required | [outside_sql] |
|
|
791
|
+
| `OrderItem` | `outside_sql` | This ORDER BY item is not supported | [outside_sql] |
|
|
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] |
|
|
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] |
|
|
800
|
+
| `RowKeyType` | `outside_sql` | Row IN requires TEXT or DOUBLE keys; NOT IN also requires non-null keys on both sides | [outside_sql] |
|
|
801
|
+
| `RowLock` | `outside_sql` | SELECT row locking is not supported | [outside_sql] |
|
|
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] |
|
|
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] |
|
|
805
|
+
| `SelectClause` | `outside_sql` | This SELECT clause is not supported | [outside_sql] |
|
|
806
|
+
| `SelectOnly` | `outside_sql` | Only SELECT statements are supported | [outside_sql] |
|
|
807
|
+
| `SelectRelation` | `outside_sql` | A CTE or derived relation must contain SELECT | [outside_sql] |
|
|
808
|
+
| `SelectTarget` | `outside_sql` | This SELECT target is not supported | [outside_sql] |
|
|
809
|
+
| `SetBranches` | `outside_sql` | A set operation requires two SELECT branches | [outside_sql] |
|
|
810
|
+
| `SetOperation` | `outside_sql` | This set operation is not supported | [outside_sql] |
|
|
811
|
+
| `StarAlias` | `outside_sql` | A star projection cannot have an alias | [outside_sql] |
|
|
812
|
+
| `StarContext` | `outside_sql` | A star is only valid in SELECT projection | [outside_sql] |
|
|
813
|
+
| `StarJoinUsing` | `outside_sql` | SELECT * with JOIN USING requires explicit columns or a qualified alias.* | [outside_sql] |
|
|
814
|
+
| `StarQualification` | `outside_sql` | Use * or table_alias.* for a star projection | [outside_sql] |
|
|
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] |
|
|
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] |
|
|
819
|
+
| `StringAggregationSeparator` | `outside_sql` | STRING_AGG requires an ASCII separator without a zero byte | Replacing the requested separator would change the result. [outside_sql] |
|
|
820
|
+
| `SubqueryForm` | `outside_sql` | This subquery form is not supported | [outside_sql] |
|
|
821
|
+
| `SymmetricSubquery` | `outside_sql` | BETWEEN SYMMETRIC does not support subquery operands | [outside_sql] |
|
|
822
|
+
| `TableColumnAliases` | `outside_sql` | Table column alias lists are not supported | [outside_sql] |
|
|
823
|
+
| `TableQualification` | `outside_sql` | Schema-qualified table names are not supported | [outside_sql] |
|
|
824
|
+
| `TemporalLiteral` | `outside_sql` | Only TIMESTAMP and INTERVAL typed literals are supported | [outside_sql] |
|
|
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] |
|
|
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] |
|
|
829
|
+
| `TypeName` | `outside_sql` | This type name is not supported | [outside_sql] |
|
|
830
|
+
| `UnnestArity` | `outside_sql` | UNNEST requires exactly one argument | [outside_sql] |
|
|
831
|
+
| `UnnestForm` | `outside_sql` | UNNEST ROWS FROM, column definitions, and excess column aliases are not supported | [outside_sql] |
|
|
832
|
+
| `ValueFunction` | `outside_sql` | This SQL value function is not supported | [outside_sql] |
|
|
833
|
+
| `ValueMemberKey` | `outside_sql` | Value membership requires TEXT or DOUBLE keys; computed INT keys are not supported | [outside_sql] |
|
|
834
|
+
| `ValueSubqueryType` | `outside_sql` | Value subqueries require scalar numeric or TEXT operands without outer aggregates or windows | [outside_sql] |
|
|
835
|
+
| `WindowInheritance` | `outside_sql` | A window cannot copy a frame or override inherited PARTITION BY or ORDER BY | [outside_sql] |
|
|
836
|
+
| `WindowName` | `outside_sql` | A WINDOW definition must have a name | [outside_sql] |
|
|
837
|
+
|
|
838
|
+
## Rewrites that must not be substituted
|
|
839
|
+
|
|
840
|
+
- `SQL_UNSUPPORTED_SYNTAX`: A SELECT subquery does not make the rejected comparison executable.
|
|
841
|
+
- `SQL_UNSUPPORTED_SYNTAX`: Changing dimension 2 to dimension 1 changes NULL into an array length. Changing the dimension can change the result.
|
|
842
|
+
- `SQL_UNSUPPORTED_SYNTAX`: Returning an object or address does not preserve a numeric coordinate. An address or complete object is not an equivalent result.
|
|
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.
|
|
844
|
+
- `SQL_UNSUPPORTED_SYNTAX`: Adding an arbitrary FROM relation changes row count, including on empty input. Adding an arbitrary table can change row count.
|
|
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.
|