mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Add a regression test case for \d on an index.
Previous commit shows the need for this. The coverage isn't really thorough, but it's better than nothing.
This commit is contained in:
parent
e694cf25d7
commit
982b82d6b1
@ -2383,6 +2383,14 @@ ALTER TABLE cwi_test ADD primary key USING INDEX cwi_uniq_idx;
|
||||
Indexes:
|
||||
"cwi_uniq_idx" PRIMARY KEY, btree (a, b)
|
||||
|
||||
\d cwi_uniq_idx
|
||||
Index "public.cwi_uniq_idx"
|
||||
Column | Type | Definition
|
||||
--------+-----------------------+------------
|
||||
a | integer | a
|
||||
b | character varying(10) | b
|
||||
primary key, btree, for table "public.cwi_test"
|
||||
|
||||
CREATE UNIQUE INDEX cwi_uniq2_idx ON cwi_test(b , a);
|
||||
ALTER TABLE cwi_test DROP CONSTRAINT cwi_uniq_idx,
|
||||
ADD CONSTRAINT cwi_replaced_pkey PRIMARY KEY
|
||||
@ -2398,6 +2406,14 @@ NOTICE: ALTER TABLE / ADD CONSTRAINT USING INDEX will rename index "cwi_uniq2_i
|
||||
Indexes:
|
||||
"cwi_replaced_pkey" PRIMARY KEY, btree (b, a)
|
||||
|
||||
\d cwi_replaced_pkey
|
||||
Index "public.cwi_replaced_pkey"
|
||||
Column | Type | Definition
|
||||
--------+-----------------------+------------
|
||||
b | character varying(10) | b
|
||||
a | integer | a
|
||||
primary key, btree, for table "public.cwi_test"
|
||||
|
||||
DROP INDEX cwi_replaced_pkey; -- Should fail; a constraint depends on it
|
||||
ERROR: cannot drop index cwi_replaced_pkey because constraint cwi_replaced_pkey on table cwi_test requires it
|
||||
HINT: You can drop constraint cwi_replaced_pkey on table cwi_test instead.
|
||||
|
@ -767,6 +767,7 @@ CREATE UNIQUE INDEX cwi_uniq_idx ON cwi_test(a , b);
|
||||
ALTER TABLE cwi_test ADD primary key USING INDEX cwi_uniq_idx;
|
||||
|
||||
\d cwi_test
|
||||
\d cwi_uniq_idx
|
||||
|
||||
CREATE UNIQUE INDEX cwi_uniq2_idx ON cwi_test(b , a);
|
||||
ALTER TABLE cwi_test DROP CONSTRAINT cwi_uniq_idx,
|
||||
@ -774,6 +775,7 @@ ALTER TABLE cwi_test DROP CONSTRAINT cwi_uniq_idx,
|
||||
USING INDEX cwi_uniq2_idx;
|
||||
|
||||
\d cwi_test
|
||||
\d cwi_replaced_pkey
|
||||
|
||||
DROP INDEX cwi_replaced_pkey; -- Should fail; a constraint depends on it
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user