diff options
Diffstat (limited to 'src/test/regress/sql/alter_table.sql')
-rw-r--r-- | src/test/regress/sql/alter_table.sql | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql index e041cec8439..82c2e4ee017 100644 --- a/src/test/regress/sql/alter_table.sql +++ b/src/test/regress/sql/alter_table.sql @@ -816,6 +816,8 @@ create table dropColumnAnother (d int) inherits (dropColumnChild); alter table dropColumnchild drop column a; alter table only dropColumnChild drop column b; + + -- these three should work alter table only dropColumn drop column e; alter table dropColumnChild drop column c; @@ -913,6 +915,11 @@ alter table gc1 drop column name; -- should work and drop the attribute in all tables alter table p2 drop column height; +-- IF EXISTS test +create table dropColumnExists (); +alter table dropColumnExists drop column non_existing; --fail +alter table dropColumnExists drop column if exists non_existing; --succeed + select relname, attname, attinhcount, attislocal from pg_class join pg_attribute on (pg_class.oid = pg_attribute.attrelid) where relname in ('p1','p2','c1','gc1') and attnum > 0 and not attisdropped @@ -1057,6 +1064,8 @@ alter table anothertab alter column atcol1 drop default; alter table anothertab alter column atcol1 type boolean using case when atcol1 % 2 = 0 then true else false end; -- fails alter table anothertab drop constraint anothertab_chk; +alter table anothertab drop constraint anothertab_chk; -- fails +alter table anothertab drop constraint IF EXISTS anothertab_chk; -- succeeds alter table anothertab alter column atcol1 type boolean using case when atcol1 % 2 = 0 then true else false end; |