summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/create_am.sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-04-13 23:33:31 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-04-13 23:33:31 -0400
commit92a30a7eb0cadb008e18053f199af7de3fc1abaa (patch)
tree6c755da85fbfe8bbc896fd98b1655d8b8a32df42 /src/test/regress/sql/create_am.sql
parentc8cb7453233b31a177b08a3b2bdac4c31508dc00 (diff)
downloadpostgresql-92a30a7eb0cadb008e18053f199af7de3fc1abaa.tar.gz
Fix broken dependency-mongering for index operator classes/families.
For a long time, opclasscmds.c explained that "we do not create a dependency link to the AM [for an opclass or opfamily], because we don't currently support DROP ACCESS METHOD". Commit 473b93287040b200 invented DROP ACCESS METHOD, but it batted only 1 for 2 on adding the dependency links, and 0 for 2 on updating the comments about the topic. In passing, undo the same commit's entirely inappropriate decision to blow away an existing index as a side-effect of create_am.sql.
Diffstat (limited to 'src/test/regress/sql/create_am.sql')
-rw-r--r--src/test/regress/sql/create_am.sql21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/test/regress/sql/create_am.sql b/src/test/regress/sql/create_am.sql
index e2051c5fcd..2f116d98c7 100644
--- a/src/test/regress/sql/create_am.sql
+++ b/src/test/regress/sql/create_am.sql
@@ -5,11 +5,8 @@
-- Make gist2 over gisthandler. In fact, it would be a synonym to gist.
CREATE ACCESS METHOD gist2 TYPE INDEX HANDLER gisthandler;
--- Drop old index on fast_emp4000
-DROP INDEX grect2ind;
-
-- Try to create gist2 index on fast_emp4000: fail because opclass doesn't exist
-CREATE INDEX grect2ind ON fast_emp4000 USING gist2 (home_base);
+CREATE INDEX grect2ind2 ON fast_emp4000 USING gist2 (home_base);
-- Make operator class for boxes using gist2
CREATE OPERATOR CLASS box_ops DEFAULT
@@ -38,9 +35,12 @@ CREATE OPERATOR CLASS box_ops DEFAULT
FUNCTION 9 gist_box_fetch(internal);
-- Create gist2 index on fast_emp4000
-CREATE INDEX grect2ind ON fast_emp4000 USING gist2 (home_base);
+CREATE INDEX grect2ind2 ON fast_emp4000 USING gist2 (home_base);
--- Now check the results from plain indexscan
+-- Now check the results from plain indexscan; temporarily drop existing
+-- index grect2ind to ensure it doesn't capture the plan
+BEGIN;
+DROP INDEX grect2ind;
SET enable_seqscan = OFF;
SET enable_indexscan = ON;
SET enable_bitmapscan = OFF;
@@ -61,13 +61,10 @@ EXPLAIN (COSTS OFF)
SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL;
SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL;
--- Try to drop access method: fail because of depending objects
+ROLLBACK;
+
+-- Try to drop access method: fail because of dependent objects
DROP ACCESS METHOD gist2;
-- Drop access method cascade
DROP ACCESS METHOD gist2 CASCADE;
-
--- Reset optimizer options
-RESET enable_seqscan;
-RESET enable_indexscan;
-RESET enable_bitmapscan;