summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane2007-09-03 01:18:33 +0000
committerTom Lane2007-09-03 01:18:33 +0000
commita4df52f95ff315dd10beca27cf93ff652be62153 (patch)
treed53044600aa8cb5a73382e67d9f76849280307b9 /src/test
parent2abae34a2e8fde42be731b4e18d44cd08901464d (diff)
Fix breakage of GIN support for varchar[] and cidr[] that I introduced in the
operator-family rewrite. I had mistakenly supposed that these could use the pg_amproc entries for text[] and inet[] respectively. However, binary compatibility of the underlying types does not make two array types binary compatible (since they must differ in the header field that gives the element type OID), and so the index support code doesn't consider those entries applicable. Add back the missing pg_amproc entries, and add an opr_sanity query to try to catch such mistakes in future. Per report from Gregory Maxwell.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/opr_sanity.out12
-rw-r--r--src/test/regress/sql/opr_sanity.sql10
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out
index a8aecd1dee6..b4d7d70d59c 100644
--- a/src/test/regress/expected/opr_sanity.out
+++ b/src/test/regress/expected/opr_sanity.out
@@ -940,6 +940,18 @@ WHERE p2.opfmethod = p1.oid AND p3.amprocfamily = p2.oid AND
--------+---------+----------------+-----------------
(0 rows)
+-- Also, check if there are any pg_opclass entries that don't seem to have
+-- pg_amproc support.
+SELECT amname, opcname, count(*)
+FROM pg_am am JOIN pg_opclass op ON opcmethod = am.oid
+ LEFT JOIN pg_amproc p ON amprocfamily = opcfamily AND
+ amproclefttype = amprocrighttype AND amproclefttype = opcintype
+GROUP BY amname, amsupport, opcname, amprocfamily
+HAVING count(*) != amsupport OR amprocfamily IS NULL;
+ amname | opcname | count
+--------+---------+-------
+(0 rows)
+
-- Unfortunately, we can't check the amproc link very well because the
-- signature of the function may be different for different support routines
-- or different base data types.
diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql
index 54c60c1a6d9..037eb9e74db 100644
--- a/src/test/regress/sql/opr_sanity.sql
+++ b/src/test/regress/sql/opr_sanity.sql
@@ -751,6 +751,16 @@ WHERE p2.opfmethod = p1.oid AND p3.amprocfamily = p2.oid AND
p4.amproclefttype = p3.amproclefttype AND
p4.amprocrighttype = p3.amprocrighttype);
+-- Also, check if there are any pg_opclass entries that don't seem to have
+-- pg_amproc support.
+
+SELECT amname, opcname, count(*)
+FROM pg_am am JOIN pg_opclass op ON opcmethod = am.oid
+ LEFT JOIN pg_amproc p ON amprocfamily = opcfamily AND
+ amproclefttype = amprocrighttype AND amproclefttype = opcintype
+GROUP BY amname, amsupport, opcname, amprocfamily
+HAVING count(*) != amsupport OR amprocfamily IS NULL;
+
-- Unfortunately, we can't check the amproc link very well because the
-- signature of the function may be different for different support routines
-- or different base data types.