@@ -2383,6 +2383,14 @@ ALTER TABLE cwi_test ADD primary key USING INDEX cwi_uniq_idx;
23832383Indexes:
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+
23862394CREATE UNIQUE INDEX cwi_uniq2_idx ON cwi_test(b , a);
23872395ALTER 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
23982406Indexes:
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+
24012417DROP INDEX cwi_replaced_pkey; -- Should fail; a constraint depends on it
24022418ERROR: cannot drop index cwi_replaced_pkey because constraint cwi_replaced_pkey on table cwi_test requires it
24032419HINT: You can drop constraint cwi_replaced_pkey on table cwi_test instead.
0 commit comments