Skip to content

Commit 982b82d

Browse files
committed
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.
1 parent e694cf2 commit 982b82d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/test/regress/expected/create_index.out

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,6 +2383,14 @@ ALTER TABLE cwi_test ADD primary key USING INDEX cwi_uniq_idx;
23832383
Indexes:
23842384
"cwi_uniq_idx" PRIMARY KEY, btree (a, b)
23852385

2386+
\d cwi_uniq_idx
2387+
Index "public.cwi_uniq_idx"
2388+
Column | Type | Definition
2389+
--------+-----------------------+------------
2390+
a | integer | a
2391+
b | character varying(10) | b
2392+
primary key, btree, for table "public.cwi_test"
2393+
23862394
CREATE UNIQUE INDEX cwi_uniq2_idx ON cwi_test(b , a);
23872395
ALTER TABLE cwi_test DROP CONSTRAINT cwi_uniq_idx,
23882396
ADD CONSTRAINT cwi_replaced_pkey PRIMARY KEY
@@ -2398,6 +2406,14 @@ NOTICE: ALTER TABLE / ADD CONSTRAINT USING INDEX will rename index "cwi_uniq2_i
23982406
Indexes:
23992407
"cwi_replaced_pkey" PRIMARY KEY, btree (b, a)
24002408

2409+
\d cwi_replaced_pkey
2410+
Index "public.cwi_replaced_pkey"
2411+
Column | Type | Definition
2412+
--------+-----------------------+------------
2413+
b | character varying(10) | b
2414+
a | integer | a
2415+
primary key, btree, for table "public.cwi_test"
2416+
24012417
DROP INDEX cwi_replaced_pkey; -- Should fail; a constraint depends on it
24022418
ERROR: cannot drop index cwi_replaced_pkey because constraint cwi_replaced_pkey on table cwi_test requires it
24032419
HINT: You can drop constraint cwi_replaced_pkey on table cwi_test instead.

src/test/regress/sql/create_index.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,13 +767,15 @@ CREATE UNIQUE INDEX cwi_uniq_idx ON cwi_test(a , b);
767767
ALTER TABLE cwi_test ADD primary key USING INDEX cwi_uniq_idx;
768768

769769
\d cwi_test
770+
\d cwi_uniq_idx
770771

771772
CREATE UNIQUE INDEX cwi_uniq2_idx ON cwi_test(b , a);
772773
ALTER TABLE cwi_test DROP CONSTRAINT cwi_uniq_idx,
773774
ADD CONSTRAINT cwi_replaced_pkey PRIMARY KEY
774775
USING INDEX cwi_uniq2_idx;
775776

776777
\d cwi_test
778+
\d cwi_replaced_pkey
777779

778780
DROP INDEX cwi_replaced_pkey; -- Should fail; a constraint depends on it
779781

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy