-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
schema_change_feature_flags
312 lines (229 loc) · 12.8 KB
/
schema_change_feature_flags
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# Test all feature flags when set to off in SQL package.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE;
# Test CREATE DATABASE.
statement error pq: feature CREATE DATABASE is part of the schema change category, which was disabled by the database administrator
CREATE DATABASE d;
# Test CREATE TABLE.
statement error pq: feature CREATE TABLE is part of the schema change category, which was disabled by the database administrator
CREATE TABLE t();
# Test CREATE SCHEMA.
statement error pq: feature CREATE SCHEMA is part of the schema change category, which was disabled by the database administrator
CREATE SCHEMA s;
# Test CREATE TYPE.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE SCHEMA s;
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE
statement error pq: feature CREATE TYPE is part of the schema change category, which was disabled by the database administrator
CREATE TYPE s.typ AS ENUM ()
# Test CREATE VIEW.
statement error pq: feature CREATE VIEW is part of the schema change category, which was disabled by the database administrator
CREATE VIEW public.bar (x) AS SELECT 1 AS x
# Test CREATE SEQUENCE.
statement error pq: feature CREATE SEQUENCE is part of the schema change category, which was disabled by the database administrator
CREATE SEQUENCE seq
# Test CREATE INDEX.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE TABLE t1(a INT8, b INT8);
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE
statement error pq: feature CREATE INDEX is part of the schema change category, which was disabled by the database administrator
CREATE INDEX on t1 (a, b)
# Test ALTER DATABASE OWNER.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE DATABASE d;
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE
statement error pq: feature ALTER DATABASE is part of the schema change category, which was disabled by the database administrator
ALTER DATABASE d OWNER TO testuser
# Test ALTER DATABASE ADD REGION.
statement error pq: feature ALTER DATABASE is part of the schema change category, which was disabled by the database administrator
ALTER DATABASE d ADD REGION "us-west-1"
# Test ALTER DATABASE DROP REGION.
statement error pq: feature ALTER DATABASE is part of the schema change category, which was disabled by the database administrator
ALTER DATABASE d DROP REGION "us-west-1"
# Test ALTER DATABASE SURVIVE.
statement error pq: feature ALTER DATABASE is part of the schema change category, which was disabled by the database administrator
ALTER DATABASE d SURVIVE REGION FAILURE
# Test RENAME DATABASE.
statement error pq: feature ALTER DATABASE is part of the schema change category, which was disabled by the database administrator
ALTER DATABASE d RENAME TO r
# Test REPARENT DATABASE
statement error pq: cannot perform ALTER DATABASE CONVERT TO SCHEMA in version
ALTER DATABASE d CONVERT TO SCHEMA WITH PARENT test
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE TABLE t();
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE
# Test ALTER TABLE PARTITION BY.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 PARTITION BY NOTHING
# Test ALTER TABLE ADD CONSTRAINT.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 ADD CONSTRAINT a_unique UNIQUE (a)
# Test ALTER TABLE RENAME CONSTRAINT.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 RENAME CONSTRAINT a_unique to r
# Test ALTER TABLE ADD COLUMN.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 ADD COLUMN a STRING
# Test ALTER TABLE DROP COLUMN.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 DROP COLUMN IF EXISTS a
# Test ALTER TABLE DROP CONSTRAINT.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 DROP CONSTRAINT IF EXISTS a_unique
# Test ALTER TABLE ALTER COLUMN SET.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 ALTER COLUMN a SET NOT NULL
# Test ALTER TABLE ALTER COLUMN DROP NOT NULL.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 ALTER COLUMN a DROP NOT NULL
# Test ALTER TABLE ALTER COLUMN DROP STORED.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 ALTER COLUMN a DROP STORED
# Test ALTER TABLE CONFIGURE ZONE.
statement error pq: feature CONFIGURE ZONE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 CONFIGURE ZONE USING num_replicas=5
# Test RENAME TABLE.
statement error pq: feature RENAME TABLE/VIEW/SEQUENCE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t RENAME TO r
# Test ALTER TABLE SET SCHEMA.
statement error pq: feature ALTER TABLE/VIEW/SEQUENCE SET SCHEMA is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t SET SCHEMA s
# Test ALTER TABLE SET LOCALITY REGIONAL BY ROW.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t SET LOCALITY REGIONAL BY ROW
# Test ALTER TABLE SPLIT AT.
statement error pq: feature ALTER TABLE/INDEX SPLIT AT is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 SPLIT AT VALUES ('1')
# Test ALTER TABLE UNSPLIT AT.
statement error pq: feature ALTER TABLE/INDEX UNSPLIT AT is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 UNSPLIT AT VALUES ('1')
# Test ALTER TABLE UNSPLIT ALL.
statement error pq: feature ALTER TABLE/INDEX UNSPLIT ALL is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 UNSPLIT ALL
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE INDEX i on t1 (a, b);
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE;
# Test RENAME COLUMN, throws ALTER TABLE error.
statement error pq: feature ALTER TABLE is part of the schema change category, which was disabled by the database administrator
ALTER TABLE t1 RENAME COLUMN a to c
# Test ALTER INDEX CONFIGURE ZONE.
statement error pq: feature CONFIGURE ZONE is part of the schema change category, which was disabled by the database administrator
ALTER INDEX t1@i CONFIGURE ZONE DISCARD
# Test RENAME INDEX
statement error pq: feature RENAME INDEX is part of the schema change category, which was disabled by the database administrator
ALTER INDEX t1@i RENAME TO r
# TODO(angelaw): Test ALTER INDEX SPLIT AT. This does not throw error.
statement error pq: feature ALTER TABLE/INDEX SPLIT AT is part of the schema change category, which was disabled by the database administrator
ALTER INDEX t1@i SPLIT AT VALUES('1')
# Test ALTER INDEX UNSPLIT AT.
statement error pq: feature ALTER TABLE/INDEX UNSPLIT AT is part of the schema change category, which was disabled by the database administrator
ALTER INDEX t1@i UNSPLIT AT VALUES('1')
# Test ALTER INDEX UNSPLIT ALL.
statement error pq: feature ALTER TABLE/INDEX UNSPLIT ALL is part of the schema change category, which was disabled by the database administrator
ALTER INDEX t1@i UNSPLIT ALL
# Test RENAME SCHEMA, throws ALTER SCHEMA error.
statement error pq: feature ALTER SCHEMA is part of the schema change category, which was disabled by the database administrator
ALTER SCHEMA s RENAME TO r
# Test ALTER SCHEMA.
statement error pq: feature ALTER SCHEMA is part of the schema change category, which was disabled by the database administrator
ALTER SCHEMA s OWNER TO testuser
# Test ALTER TYPE.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE TYPE s.typ AS ENUM ();
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE
# Test ALTER TYPE ADD VALUE.
statement error pq: feature ALTER TYPE is part of the schema change category, which was disabled by the database administrator
ALTER TYPE s.typ ADD VALUE 'hi'
# Test ALTER TYPE RENAME VALUE TO.
statement error pq: feature ALTER TYPE is part of the schema change category, which was disabled by the database administrator
ALTER TYPE s.typ RENAME VALUE 'hi' TO 'no'
# Test ALTER TYPE RENAME TO.
statement error pq: feature ALTER TYPE is part of the schema change category, which was disabled by the database administrator
ALTER TYPE s.typ RENAME TO no
# Test ALTER TYPE SET SCHEMA.
statement error pq: feature ALTER TYPE is part of the schema change category, which was disabled by the database administrator
ALTER TYPE s.typ SET SCHEMA s
# Test ALTER SEQUENCE.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE SEQUENCE seq;
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE
# Test RENAME SEQUENCE.
statement error pq: feature RENAME TABLE/VIEW/SEQUENCE is part of the schema change category, which was disabled by the database administrator
ALTER SEQUENCE seq RENAME TO something
# Test ALTER SEQUENCE SET SCHEMA
statement error pq: feature ALTER TABLE/VIEW/SEQUENCE SET SCHEMA is part of the schema change category, which was disabled by the database administrator
ALTER SEQUENCE seq SET SCHEMA s
statement error pq: feature ALTER SEQUENCE is part of the schema change category, which was disabled by the database administrator
ALTER SEQUENCE seq NO CYCLE
# Test REASSIGN OWNED BY.
statement error pq: feature REASSIGN OWNED BY is part of the schema change category, which was disabled by the database administrator
REASSIGN OWNED BY root TO testuser
# Test DROP OWNED BY.
statement error pq: feature DROP OWNED BY is part of the schema change category, which was disabled by the database administrator
DROP OWNED BY testuser
# Test DROP DATABASE.
statement error pq: feature DROP DATABASE is part of the schema change category, which was disabled by the database administrator
DROP DATABASE d
# Test DROP SCHEMA.
statement error pq: feature DROP SCHEMA is part of the schema change category, which was disabled by the database administrator
DROP SCHEMA s
# Test DROP TYPE.
statement error pq: feature DROP TYPE is part of the schema change category, which was disabled by the database administrator
DROP TYPE s.typ
# Test DROP TABLE.
statement error pq: feature DROP TABLE is part of the schema change category, which was disabled by the database administrator
DROP TABLE t
# Test DROP SEQUENCE.
statement error pq: feature DROP SEQUENCE is part of the schema change category, which was disabled by the database administrator
DROP SEQUENCE seq
# Test DROP VIEW.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE;
statement ok
CREATE VIEW public.bar (x) AS SELECT 1 AS x;
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = FALSE
# Test ALTER VIEW SET SCHEMA
statement error pq: feature ALTER TABLE/VIEW/SEQUENCE SET SCHEMA is part of the schema change category, which was disabled by the database administrator
ALTER VIEW public.bar SET SCHEMA s
statement error pq: feature DROP VIEW is part of the schema change category, which was disabled by the database administrator
DROP VIEW public.bar
# Test DROP INDEX.
statement error pq: feature DROP INDEX is part of the schema change category, which was disabled by the database administrator
DROP INDEX t1@i
# Test COMMENT ON COLUMN.
statement error pq: feature COMMENT ON COLUMN is part of the schema change category, which was disabled by the database administrator
COMMENT ON COLUMN t.a IS 'comment'
# Test COMMENT ON DATABASE.
statement error pq: feature COMMENT ON DATABASE is part of the schema change category, which was disabled by the database administrator
COMMENT ON DATABASE d IS 'comment'
# Test COMMENT ON INDEX.
statement error pq: feature COMMENT ON INDEX is part of the schema change category, which was disabled by the database administrator
COMMENT ON INDEX t1@i IS 'comment'
# Test COMMENT ON TABLE.
statement error pq: feature COMMENT ON TABLE is part of the schema change category, which was disabled by the database administrator
COMMENT ON TABLE t IS 'comment'
# Reset feature flag to true so that test objects can be dropped.
statement ok
SET CLUSTER SETTING feature.schema_change.enabled = TRUE