Test all contrib-created operator classes with amvalidate.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Nov 2016 20:05:22 +0000 (15:05 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 29 Nov 2016 20:05:22 +0000 (15:05 -0500)
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/7076.1480446837@sss.pgh.pa.us

25 files changed:
contrib/btree_gin/expected/install_btree_gin.out
contrib/btree_gin/sql/install_btree_gin.sql
contrib/btree_gist/expected/init.out
contrib/btree_gist/sql/init.sql
contrib/citext/expected/citext.out
contrib/citext/expected/citext_1.out
contrib/citext/sql/citext.sql
contrib/cube/expected/cube.out
contrib/cube/expected/cube_2.out
contrib/cube/sql/cube.sql
contrib/hstore/expected/hstore.out
contrib/hstore/sql/hstore.sql
contrib/intarray/expected/_int.out
contrib/intarray/sql/_int.sql
contrib/isn/expected/isn.out
contrib/isn/sql/isn.sql
contrib/ltree/expected/ltree.out
contrib/ltree/sql/ltree.sql
contrib/pg_trgm/expected/pg_trgm.out
contrib/pg_trgm/sql/pg_trgm.sql
contrib/seg/expected/seg.out
contrib/seg/expected/seg_1.out
contrib/seg/sql/seg.sql
contrib/tsearch2/expected/tsearch2.out
contrib/tsearch2/sql/tsearch2.sql

index 0fae4c5bfe0b4e61237834a47cfff750c8ffa72b..631a0df722208986d241a628fbc21737f6e11c6f 100644 (file)
@@ -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)
+
index 0fae4c5bfe0b4e61237834a47cfff750c8ffa72b..746e77654f808154caf5b9a634ff21824ed296c0 100644 (file)
@@ -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);
index afe05346824f28ea6476824027da25b49d8c4f4b..ce4559d8b03fdcf00367f0fabfe08e03367c9dd7 100644 (file)
@@ -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)
+
index afe05346824f28ea6476824027da25b49d8c4f4b..a6d2cffc677e94b0e12812a6353ead3feb6c08d8 100644 (file)
@@ -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);
index 1a1e6c82f77cd8982302d0e2efde29683eb5205b..bc5d92eb9178fff1f0072d994732d92a00b1c95f 100644 (file)
@@ -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;
index 3331dbc2553c64c80f1c62567d6ffd5e1e0d896c..3d02d06b9c3967e6ffff0f58045e5c4687825657 100644 (file)
@@ -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;
index a8024846635ca76a9292b77db3a3a6ad09d519a2..f70f9ebae98354a64c6c9b992c41ba8a6331f7ab 100644 (file)
@@ -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 <>.
index 095491fa0c1c7ffed2f469065b23c5cd6d7ea307..ada54b2885fd0b8101f220ca8f601db8c8caecd3 100644 (file)
@@ -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
 --
index eaeae45fca610369ea5ceb9a2d49fa533a03643c..c58614ef05f0e0e306f2d4eb52e3d59974e65cb3 100644 (file)
@@ -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
 --
index cc5a1ce458813fe4a8afc1db6e6bd73657382ec0..a61fba1ea8182b499a3c0f8becc5c5064abbd74f 100644 (file)
@@ -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
 --
index 6773a2b72f3d80432f90398d48b390561097c8d9..f0d421602d5f01fd7a24aaa4ac9ef3ba490a11a8 100644 (file)
@@ -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;
index 48514789e647c41fa5365e831627035fc9cd1565..d64b9f77c752d78ca23a418e6baad6523f5bf6d9 100644 (file)
@@ -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;
index 962e5c6a4b1ddae2cf7eaa4bf46f41877c45dcde..0a5dd463acb087180fa64a0d45c3bb2f39fc3d15 100644 (file)
@@ -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 
 --------
index f6fe2de55c587b7d0f3f89fb2af764f1deab291d..44e1a729b4f0dbf29d8b829d0b6c96b00897457e 100644 (file)
@@ -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}');
index 140bc866561479cf55bfa54f91c9b88c34d700f3..ef9d3a61e725b3853472f10e5f6fd64818360b80 100644 (file)
@@ -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
 --
index 5ef6d8aa3bee25bf0f5ac497e2952da7afff0168..71577d5590f8703638e49f116e6d81acc3d9e28f 100644 (file)
@@ -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
 --
index da6e39a785f18a3b5504f6ad60e2937240eb33ac..db52069c266b961316f3a3705b785f121e740c45 100644 (file)
@@ -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 
 -------
index 46cfa41a4195596ae8f3a151f94960473e042ba0..b4f62e3febbd103e0466590e62d37bbf56eaeb03 100644 (file)
@@ -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;
index 9bc55f1d0d33e4d40d7ebd7a6e6f909022bfa254..f646cbf90af215509bb83176ba9e9073c21685df 100644 (file)
@@ -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 
 -----------
index 244946bb8db558ca0a450d327f58731b381f5d0e..34d0614edbca3cc97c0e282ca887dc3d32ec898d 100644 (file)
@@ -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');
index 1f82a4abb86337a8b3501e96948323980d1fb6aa..18010c4d5cf506d264cb62418e7d60077fb2a764 100644 (file)
@@ -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
 --
index 563c744b2d6584ede0a7e60b13a380c5078e8eca..566ce394ed0f4e2b1f970b85f16ab7c850fd6efb 100644 (file)
@@ -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
 --
index 7b7f138dbf68cf8009594953f58e2f34f180304d..aa9193147406d236bdb61839d877c4404da51f12 100644 (file)
@@ -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
 --
index e84e4d27f213e23c422938fd80d5a98e0228273c..eef85ef09deb7c3adee9e31d9e190867c7664186 100644 (file)
@@ -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 
index 53e3073af45b062f986f7875c9641cba2e345b82..2c37c4a1dd23a18d5d80e7d190feedb6150940f1 100644 (file)
@@ -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;