Skip to content

Commit 92912e6

Browse files
craig[bot]shghasemi
andcommitted
Merge #158141
158141: sql: add ALTER TABLE ... SET SCHEMA to the declerative schema changer r=shghasemi a=shghasemi This change adds support for `ALTER TABLE ... SET SCHEMA` to the declarative schema changer. Before, this operation was ran by the legacy schema changer. Epic [CRDB-31281](https://cockroachlabs.atlassian.net/browse/CRDB-31281) Fixes #155989 Release note (sql change): `ALTER TABLE ... SET SCHEMA` is supported by the declerative schema changer. Co-authored-by: Shadi Ghasemitaheri <shadi.ghasemitaheri@cockroachlabs.com>
2 parents dba914a + 509b33b commit 92912e6

File tree

130 files changed

+1066
-739
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+1066
-739
lines changed

pkg/backup/testdata/backup-restore/plpgsql_procedures

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,10 @@ ALTER TABLE sc1.tbl1 RENAME TO tbl1_new
188188
pq: cannot rename relation "db1_new.sc1.tbl1" because procedure "p1" depends on it
189189
HINT: consider dropping "p1" first.
190190

191-
# TODO(mgartner): The error message should say "procedure".
192191
exec-sql
193192
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
194193
----
195-
pq: cannot set schema on relation "tbl1" because function "p1" depends on it
194+
pq: cannot set schema on relation "db1_new.sc1.tbl1" because procedure "p1" depends on it
196195
HINT: consider dropping "p1" first.
197196

198197
exec-sql
@@ -389,7 +388,7 @@ HINT: consider dropping "p1" first.
389388
exec-sql
390389
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
391390
----
392-
pq: cannot set schema on relation "tbl1" because function "p1" depends on it
391+
pq: cannot set schema on relation "db1.sc1.tbl1" because procedure "p1" depends on it
393392
HINT: consider dropping "p1" first.
394393

395394
exec-sql

pkg/backup/testdata/backup-restore/plpgsql_user_defined_functions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ HINT: consider dropping "f1" first.
253253
exec-sql
254254
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
255255
----
256-
pq: cannot set schema on relation "tbl1" because function "f1" depends on it
256+
pq: cannot set schema on relation "db1_new.sc1.tbl1" because function "f1" depends on it
257257
HINT: consider dropping "f1" first.
258258

259259
exec-sql
@@ -469,7 +469,7 @@ HINT: consider dropping "f1" first.
469469
exec-sql
470470
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
471471
----
472-
pq: cannot set schema on relation "tbl1" because function "f1" depends on it
472+
pq: cannot set schema on relation "db1.sc1.tbl1" because function "f1" depends on it
473473
HINT: consider dropping "f1" first.
474474

475475
exec-sql

pkg/backup/testdata/backup-restore/procedures

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,10 @@ ALTER TABLE sc1.tbl1 RENAME TO tbl1_new
174174
pq: cannot rename relation "db1_new.sc1.tbl1" because procedure "p1" depends on it
175175
HINT: consider dropping "p1" first.
176176

177-
# TODO(mgartner): The error message should say "procedure".
178177
exec-sql
179178
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
180179
----
181-
pq: cannot set schema on relation "tbl1" because function "p1" depends on it
180+
pq: cannot set schema on relation "db1_new.sc1.tbl1" because procedure "p1" depends on it
182181
HINT: consider dropping "p1" first.
183182

184183
exec-sql
@@ -361,7 +360,7 @@ HINT: consider dropping "p1" first.
361360
exec-sql
362361
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
363362
----
364-
pq: cannot set schema on relation "tbl1" because function "p1" depends on it
363+
pq: cannot set schema on relation "db1.sc1.tbl1" because procedure "p1" depends on it
365364
HINT: consider dropping "p1" first.
366365

367366
exec-sql

pkg/backup/testdata/backup-restore/triggers

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ pq: cannot rename relation "db1_new.sc1.tbl1" because trigger "tr1" on table "tb
223223
exec-sql
224224
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
225225
----
226-
pq: cannot set schema on relation "tbl1" because trigger "tr1" on table "tbl1" depends on it
226+
pq: cannot set schema on relation "db1_new.sc1.tbl1" because trigger "tr1" on table "tbl1" depends on it
227227

228228
exec-sql
229229
DROP TYPE sc1.enum1

pkg/backup/testdata/backup-restore/user-defined-functions

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ HINT: consider dropping "f1" first.
171171
exec-sql
172172
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
173173
----
174-
pq: cannot set schema on relation "tbl1" because function "f1" depends on it
174+
pq: cannot set schema on relation "db1_new.sc1.tbl1" because function "f1" depends on it
175175
HINT: consider dropping "f1" first.
176176

177177
exec-sql
@@ -358,7 +358,7 @@ HINT: consider dropping "f1" first.
358358
exec-sql
359359
ALTER TABLE sc1.tbl1 SET SCHEMA sc2;
360360
----
361-
pq: cannot set schema on relation "tbl1" because function "f1" depends on it
361+
pq: cannot set schema on relation "db1.sc1.tbl1" because function "f1" depends on it
362362
HINT: consider dropping "f1" first.
363363

364364
exec-sql

pkg/ccl/schemachangerccl/sctestbackupccl/backup_base_generated_test.go

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)