summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2016-11-29 20:05:22 +0000
committerTom Lane2016-11-29 20:05:22 +0000
commitade49c605f1d8f517497829363f8b83f69c73a60 (patch)
tree95ac16d5feb33f0fc017c2973e5afee303cdfd95
parent11da83a0e70d32ed0e06a5c948cd8343f8ad5102 (diff)
Test all contrib-created operator classes with amvalidate.
I'd supposed that people would do this manually when creating new operator classes, but the folly of that was exposed today. The tests seem fast enough that we can just apply them during the normal regression tests. contrib/isn fails the checks for lack of complete sets of cross-type operators. That's a nice-to-have policy rather than a functional requirement, so leave it as-is, but insert ORDER BY in the query to ensure consistent cross-platform output. Discussion: https://postgr.es/m/[email protected]
-rw-r--r--contrib/btree_gin/expected/install_btree_gin.out8
-rw-r--r--contrib/btree_gin/sql/install_btree_gin.sql5
-rw-r--r--contrib/btree_gist/expected/init.out8
-rw-r--r--contrib/btree_gist/sql/init.sql5
-rw-r--r--contrib/citext/expected/citext.out8
-rw-r--r--contrib/citext/expected/citext_1.out8
-rw-r--r--contrib/citext/sql/citext.sql5
-rw-r--r--contrib/cube/expected/cube.out8
-rw-r--r--contrib/cube/expected/cube_2.out8
-rw-r--r--contrib/cube/sql/cube.sql5
-rw-r--r--contrib/hstore/expected/hstore.out8
-rw-r--r--contrib/hstore/sql/hstore.sql5
-rw-r--r--contrib/intarray/expected/_int.out8
-rw-r--r--contrib/intarray/sql/_int.sql5
-rw-r--r--contrib/isn/expected/isn.out44
-rw-r--r--contrib/isn/sql/isn.sql9
-rw-r--r--contrib/ltree/expected/ltree.out8
-rw-r--r--contrib/ltree/sql/ltree.sql5
-rw-r--r--contrib/pg_trgm/expected/pg_trgm.out8
-rw-r--r--contrib/pg_trgm/sql/pg_trgm.sql5
-rw-r--r--contrib/seg/expected/seg.out8
-rw-r--r--contrib/seg/expected/seg_1.out8
-rw-r--r--contrib/seg/sql/seg.sql5
-rw-r--r--contrib/tsearch2/expected/tsearch2.out8
-rw-r--r--contrib/tsearch2/sql/tsearch2.sql5
25 files changed, 207 insertions, 0 deletions
diff --git a/contrib/btree_gin/expected/install_btree_gin.out b/contrib/btree_gin/expected/install_btree_gin.out
index 0fae4c5bfe0..631a0df7222 100644
--- a/contrib/btree_gin/expected/install_btree_gin.out
+++ b/contrib/btree_gin/expected/install_btree_gin.out
@@ -1 +1,9 @@
CREATE EXTENSION btree_gin;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
diff --git a/contrib/btree_gin/sql/install_btree_gin.sql b/contrib/btree_gin/sql/install_btree_gin.sql
index 0fae4c5bfe0..746e77654f8 100644
--- a/contrib/btree_gin/sql/install_btree_gin.sql
+++ b/contrib/btree_gin/sql/install_btree_gin.sql
@@ -1 +1,6 @@
CREATE EXTENSION btree_gin;
+
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
diff --git a/contrib/btree_gist/expected/init.out b/contrib/btree_gist/expected/init.out
index afe05346824..ce4559d8b03 100644
--- a/contrib/btree_gist/expected/init.out
+++ b/contrib/btree_gist/expected/init.out
@@ -1 +1,9 @@
CREATE EXTENSION btree_gist;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
diff --git a/contrib/btree_gist/sql/init.sql b/contrib/btree_gist/sql/init.sql
index afe05346824..a6d2cffc677 100644
--- a/contrib/btree_gist/sql/init.sql
+++ b/contrib/btree_gist/sql/init.sql
@@ -1 +1,6 @@
CREATE EXTENSION btree_gist;
+
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
diff --git a/contrib/citext/expected/citext.out b/contrib/citext/expected/citext.out
index 1a1e6c82f77..bc5d92eb917 100644
--- a/contrib/citext/expected/citext.out
+++ b/contrib/citext/expected/citext.out
@@ -2,6 +2,14 @@
-- Test citext datatype
--
CREATE EXTENSION citext;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
-- Test the operators and indexing functions
-- Test = and <>.
SELECT 'a'::citext = 'a'::citext AS t;
diff --git a/contrib/citext/expected/citext_1.out b/contrib/citext/expected/citext_1.out
index 3331dbc2553..3d02d06b9c3 100644
--- a/contrib/citext/expected/citext_1.out
+++ b/contrib/citext/expected/citext_1.out
@@ -2,6 +2,14 @@
-- Test citext datatype
--
CREATE EXTENSION citext;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
-- Test the operators and indexing functions
-- Test = and <>.
SELECT 'a'::citext = 'a'::citext AS t;
diff --git a/contrib/citext/sql/citext.sql b/contrib/citext/sql/citext.sql
index a8024846635..f70f9ebae98 100644
--- a/contrib/citext/sql/citext.sql
+++ b/contrib/citext/sql/citext.sql
@@ -4,6 +4,11 @@
CREATE EXTENSION citext;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
-- Test the operators and indexing functions
-- Test = and <>.
diff --git a/contrib/cube/expected/cube.out b/contrib/cube/expected/cube.out
index 095491fa0c1..ada54b2885f 100644
--- a/contrib/cube/expected/cube.out
+++ b/contrib/cube/expected/cube.out
@@ -2,6 +2,14 @@
-- Test cube datatype
--
CREATE EXTENSION cube;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
--
-- testing the input and output functions
--
diff --git a/contrib/cube/expected/cube_2.out b/contrib/cube/expected/cube_2.out
index eaeae45fca6..c58614ef05f 100644
--- a/contrib/cube/expected/cube_2.out
+++ b/contrib/cube/expected/cube_2.out
@@ -2,6 +2,14 @@
-- Test cube datatype
--
CREATE EXTENSION cube;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
--
-- testing the input and output functions
--
diff --git a/contrib/cube/sql/cube.sql b/contrib/cube/sql/cube.sql
index cc5a1ce4588..a61fba1ea81 100644
--- a/contrib/cube/sql/cube.sql
+++ b/contrib/cube/sql/cube.sql
@@ -4,6 +4,11 @@
CREATE EXTENSION cube;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
--
-- testing the input and output functions
--
diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out
index 6773a2b72f3..f0d421602d5 100644
--- a/contrib/hstore/expected/hstore.out
+++ b/contrib/hstore/expected/hstore.out
@@ -1,4 +1,12 @@
CREATE EXTENSION hstore;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
set escape_string_warning=off;
--hstore;
select ''::hstore;
diff --git a/contrib/hstore/sql/hstore.sql b/contrib/hstore/sql/hstore.sql
index 48514789e64..d64b9f77c75 100644
--- a/contrib/hstore/sql/hstore.sql
+++ b/contrib/hstore/sql/hstore.sql
@@ -1,5 +1,10 @@
CREATE EXTENSION hstore;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
set escape_string_warning=off;
--hstore;
diff --git a/contrib/intarray/expected/_int.out b/contrib/intarray/expected/_int.out
index 962e5c6a4b1..0a5dd463acb 100644
--- a/contrib/intarray/expected/_int.out
+++ b/contrib/intarray/expected/_int.out
@@ -1,4 +1,12 @@
CREATE EXTENSION intarray;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
SELECT intset(1234);
intset
--------
diff --git a/contrib/intarray/sql/_int.sql b/contrib/intarray/sql/_int.sql
index f6fe2de55c5..44e1a729b4f 100644
--- a/contrib/intarray/sql/_int.sql
+++ b/contrib/intarray/sql/_int.sql
@@ -1,5 +1,10 @@
CREATE EXTENSION intarray;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
SELECT intset(1234);
SELECT icount('{1234234,234234}');
SELECT sort('{1234234,-30,234234}');
diff --git a/contrib/isn/expected/isn.out b/contrib/isn/expected/isn.out
index 140bc866561..ef9d3a61e72 100644
--- a/contrib/isn/expected/isn.out
+++ b/contrib/isn/expected/isn.out
@@ -2,6 +2,50 @@
-- Test ISN extension
--
CREATE EXTENSION isn;
+-- Check whether any of our opclasses fail amvalidate
+-- ... they will, because of missing cross-type operators
+SELECT amname, opcname
+FROM (SELECT amname, opcname, opc.oid
+ FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+ WHERE opc.oid >= 16384
+ ORDER BY 1, 2 OFFSET 0) ss
+WHERE NOT amvalidate(oid);
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: btree operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+INFO: hash operator family "isn_ops" is missing cross-type operator(s)
+ amname | opcname
+--------+------------
+ btree | ean13_ops
+ btree | isbn13_ops
+ btree | isbn_ops
+ btree | ismn13_ops
+ btree | ismn_ops
+ btree | issn13_ops
+ btree | issn_ops
+ btree | upc_ops
+ hash | ean13_ops
+ hash | isbn13_ops
+ hash | isbn_ops
+ hash | ismn13_ops
+ hash | ismn_ops
+ hash | issn13_ops
+ hash | issn_ops
+ hash | upc_ops
+(16 rows)
+
--
-- test valid conversions
--
diff --git a/contrib/isn/sql/isn.sql b/contrib/isn/sql/isn.sql
index 5ef6d8aa3be..71577d5590f 100644
--- a/contrib/isn/sql/isn.sql
+++ b/contrib/isn/sql/isn.sql
@@ -4,6 +4,15 @@
CREATE EXTENSION isn;
+-- Check whether any of our opclasses fail amvalidate
+-- ... they will, because of missing cross-type operators
+SELECT amname, opcname
+FROM (SELECT amname, opcname, opc.oid
+ FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+ WHERE opc.oid >= 16384
+ ORDER BY 1, 2 OFFSET 0) ss
+WHERE NOT amvalidate(oid);
+
--
-- test valid conversions
--
diff --git a/contrib/ltree/expected/ltree.out b/contrib/ltree/expected/ltree.out
index da6e39a785f..db52069c266 100644
--- a/contrib/ltree/expected/ltree.out
+++ b/contrib/ltree/expected/ltree.out
@@ -1,4 +1,12 @@
CREATE EXTENSION ltree;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
SELECT ''::ltree;
ltree
-------
diff --git a/contrib/ltree/sql/ltree.sql b/contrib/ltree/sql/ltree.sql
index 46cfa41a419..b4f62e3febb 100644
--- a/contrib/ltree/sql/ltree.sql
+++ b/contrib/ltree/sql/ltree.sql
@@ -1,5 +1,10 @@
CREATE EXTENSION ltree;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
SELECT ''::ltree;
SELECT '1'::ltree;
SELECT '1.2'::ltree;
diff --git a/contrib/pg_trgm/expected/pg_trgm.out b/contrib/pg_trgm/expected/pg_trgm.out
index 9bc55f1d0d3..f646cbf90af 100644
--- a/contrib/pg_trgm/expected/pg_trgm.out
+++ b/contrib/pg_trgm/expected/pg_trgm.out
@@ -1,4 +1,12 @@
CREATE EXTENSION pg_trgm;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
select show_trgm('');
show_trgm
-----------
diff --git a/contrib/pg_trgm/sql/pg_trgm.sql b/contrib/pg_trgm/sql/pg_trgm.sql
index 244946bb8db..34d0614edbc 100644
--- a/contrib/pg_trgm/sql/pg_trgm.sql
+++ b/contrib/pg_trgm/sql/pg_trgm.sql
@@ -1,5 +1,10 @@
CREATE EXTENSION pg_trgm;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
select show_trgm('');
select show_trgm('(*&^$@%@');
select show_trgm('a b c');
diff --git a/contrib/seg/expected/seg.out b/contrib/seg/expected/seg.out
index 1f82a4abb86..18010c4d5cf 100644
--- a/contrib/seg/expected/seg.out
+++ b/contrib/seg/expected/seg.out
@@ -2,6 +2,14 @@
-- Test seg datatype
--
CREATE EXTENSION seg;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
--
-- testing the input and output functions
--
diff --git a/contrib/seg/expected/seg_1.out b/contrib/seg/expected/seg_1.out
index 563c744b2d6..566ce394ed0 100644
--- a/contrib/seg/expected/seg_1.out
+++ b/contrib/seg/expected/seg_1.out
@@ -2,6 +2,14 @@
-- Test seg datatype
--
CREATE EXTENSION seg;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
--
-- testing the input and output functions
--
diff --git a/contrib/seg/sql/seg.sql b/contrib/seg/sql/seg.sql
index 7b7f138dbf6..aa919314740 100644
--- a/contrib/seg/sql/seg.sql
+++ b/contrib/seg/sql/seg.sql
@@ -4,6 +4,11 @@
CREATE EXTENSION seg;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
--
-- testing the input and output functions
--
diff --git a/contrib/tsearch2/expected/tsearch2.out b/contrib/tsearch2/expected/tsearch2.out
index e84e4d27f21..eef85ef09de 100644
--- a/contrib/tsearch2/expected/tsearch2.out
+++ b/contrib/tsearch2/expected/tsearch2.out
@@ -1,4 +1,12 @@
CREATE EXTENSION tsearch2;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+ amname | opcname
+--------+---------
+(0 rows)
+
--tsvector
SELECT '1'::tsvector;
tsvector
diff --git a/contrib/tsearch2/sql/tsearch2.sql b/contrib/tsearch2/sql/tsearch2.sql
index 53e3073af45..2c37c4a1dd2 100644
--- a/contrib/tsearch2/sql/tsearch2.sql
+++ b/contrib/tsearch2/sql/tsearch2.sql
@@ -1,5 +1,10 @@
CREATE EXTENSION tsearch2;
+-- Check whether any of our opclasses fail amvalidate
+SELECT amname, opcname
+FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod
+WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid);
+
--tsvector
SELECT '1'::tsvector;
SELECT '1 '::tsvector;