From 982b82d6b1fd007b9357ce198d13a55544888534 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 14 Nov 2013 10:35:15 -0500 Subject: [PATCH] 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. --- src/test/regress/expected/create_index.out | 16 ++++++++++++++++ src/test/regress/sql/create_index.sql | 2 ++ 2 files changed, 18 insertions(+) diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out index 81c64e5d18..b7b92036bb 100644 --- a/src/test/regress/expected/create_index.out +++ b/src/test/regress/expected/create_index.out @@ -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. diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/create_index.sql index 4ee8581b87..54f9161ab1 100644 --- a/src/test/regress/sql/create_index.sql +++ b/src/test/regress/sql/create_index.sql @@ -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