diff options
| author | Robert Haas | 2015-11-19 15:49:25 +0000 |
|---|---|---|
| committer | Robert Haas | 2015-11-19 15:49:25 +0000 |
| commit | bc4996e61b98d41eacf991c18508b7a2305a68c6 (patch) | |
| tree | b0f8404f7f1fe62f6fe0c530c23e4c70acc7dede /src/test | |
| parent | f11c557e92c50d3d613d1173c15feb5310ba4744 (diff) | |
Make ALTER .. SET SCHEMA do nothing, instead of throwing an ERROR.
This was already true for CREATE EXTENSION, but historically has not
been true for other object types. Therefore, this is a backward
incompatibility. Per discussion on pgsql-hackers, everyone seems to
agree that the new behavior is better.
Marti Raudsepp, reviewed by Haribabu Kommi and myself
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/alter_generic.out | 1 | ||||
| -rw-r--r-- | src/test/regress/expected/alter_table.out | 5 | ||||
| -rw-r--r-- | src/test/regress/sql/alter_generic.sql | 1 | ||||
| -rw-r--r-- | src/test/regress/sql/alter_table.sql | 4 |
4 files changed, 8 insertions, 3 deletions
diff --git a/src/test/regress/expected/alter_generic.out b/src/test/regress/expected/alter_generic.out index 4c3c8826b75..43376eeafdd 100644 --- a/src/test/regress/expected/alter_generic.out +++ b/src/test/regress/expected/alter_generic.out @@ -40,6 +40,7 @@ ALTER FUNCTION alt_func1(int) RENAME TO alt_func3; -- OK ALTER FUNCTION alt_func2(int) OWNER TO regtest_alter_user2; -- failed (no role membership) ERROR: must be member of role "regtest_alter_user2" ALTER FUNCTION alt_func2(int) OWNER TO regtest_alter_user3; -- OK +ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp1; -- OK, already there ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp2; -- OK ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg2; -- failed (name conflict) ERROR: function alt_agg2(integer) already exists in schema "alt_nsp1" diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index 50b3c456f14..d2b6f2caced 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -2133,6 +2133,7 @@ create text search template alter1.tmpl(init = dsimple_init, lexize = dsimple_le create text search dictionary alter1.dict(template = alter1.tmpl); insert into alter1.t1(f2) values(11); insert into alter1.t1(f2) values(12); +alter table alter1.t1 set schema alter1; -- no-op, same schema alter table alter1.t1 set schema alter2; alter table alter1.v1 set schema alter2; alter function alter1.plus1(int) set schema alter2; @@ -2141,6 +2142,7 @@ alter operator class alter1.ctype_hash_ops using hash set schema alter2; alter operator family alter1.ctype_hash_ops using hash set schema alter2; alter operator alter1.=(alter1.ctype, alter1.ctype) set schema alter2; alter function alter1.same(alter1.ctype, alter1.ctype) set schema alter2; +alter type alter1.ctype set schema alter1; -- no-op, same schema alter type alter1.ctype set schema alter2; alter conversion alter1.ascii_to_utf8 set schema alter2; alter text search parser alter1.prs set schema alter2; @@ -2567,9 +2569,8 @@ ALTER TABLE new_system_table SET SCHEMA pg_catalog; -- XXX: it's currently impossible to move relations out of pg_catalog ALTER TABLE new_system_table SET SCHEMA public; ERROR: cannot remove dependency on schema pg_catalog because it is a system object --- move back, will currently error out, already there +-- move back, will be ignored -- already there ALTER TABLE new_system_table SET SCHEMA pg_catalog; -ERROR: table new_system_table is already in schema "pg_catalog" ALTER TABLE new_system_table RENAME TO old_system_table; CREATE INDEX old_system_table__othercol ON old_system_table (othercol); INSERT INTO old_system_table(othercol) VALUES ('somedata'), ('otherdata'); diff --git a/src/test/regress/sql/alter_generic.sql b/src/test/regress/sql/alter_generic.sql index ed4398b30a0..8a811d47b33 100644 --- a/src/test/regress/sql/alter_generic.sql +++ b/src/test/regress/sql/alter_generic.sql @@ -44,6 +44,7 @@ ALTER FUNCTION alt_func1(int) RENAME TO alt_func2; -- failed (name conflict) ALTER FUNCTION alt_func1(int) RENAME TO alt_func3; -- OK ALTER FUNCTION alt_func2(int) OWNER TO regtest_alter_user2; -- failed (no role membership) ALTER FUNCTION alt_func2(int) OWNER TO regtest_alter_user3; -- OK +ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp1; -- OK, already there ALTER FUNCTION alt_func2(int) SET SCHEMA alt_nsp2; -- OK ALTER AGGREGATE alt_agg1(int) RENAME TO alt_agg2; -- failed (name conflict) diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index 778791d9fd1..6740c609c6b 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -1465,6 +1465,7 @@ create text search dictionary alter1.dict(template = alter1.tmpl); insert into alter1.t1(f2) values(11); insert into alter1.t1(f2) values(12); +alter table alter1.t1 set schema alter1; -- no-op, same schema alter table alter1.t1 set schema alter2; alter table alter1.v1 set schema alter2; alter function alter1.plus1(int) set schema alter2; @@ -1473,6 +1474,7 @@ alter operator class alter1.ctype_hash_ops using hash set schema alter2; alter operator family alter1.ctype_hash_ops using hash set schema alter2; alter operator alter1.=(alter1.ctype, alter1.ctype) set schema alter2; alter function alter1.same(alter1.ctype, alter1.ctype) set schema alter2; +alter type alter1.ctype set schema alter1; -- no-op, same schema alter type alter1.ctype set schema alter2; alter conversion alter1.ascii_to_utf8 set schema alter2; alter text search parser alter1.prs set schema alter2; @@ -1704,7 +1706,7 @@ ALTER TABLE new_system_table SET SCHEMA pg_catalog; -- XXX: it's currently impossible to move relations out of pg_catalog ALTER TABLE new_system_table SET SCHEMA public; --- move back, will currently error out, already there +-- move back, will be ignored -- already there ALTER TABLE new_system_table SET SCHEMA pg_catalog; ALTER TABLE new_system_table RENAME TO old_system_table; CREATE INDEX old_system_table__othercol ON old_system_table (othercol); |
