aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-11-14 10:35:15 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-11-14 10:35:15 -0500
commit982b82d6b1fd007b9357ce198d13a55544888534 (patch)
treeec68aec3c08595314ae2d33dff5acc62666cd238 /src
parente694cf25d787354ed04310a14aa508692874dcad (diff)
downloadpostgresql-982b82d6b1fd007b9357ce198d13a55544888534.tar.gz
postgresql-982b82d6b1fd007b9357ce198d13a55544888534.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/create_index.out16
-rw-r--r--src/test/regress/sql/create_index.sql2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out
index 81c64e5d181..b7b92036bb7 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 4ee8581b871..54f9161ab1e 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