aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-02-18 11:55:57 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-02-18 11:55:57 -0500
commit472f608e436a41865b795c999bda3369725fa097 (patch)
treeaac071c5899914eacd52e2f9df292134f7212cf4
parenta5dfc94c9a2e6c0c7e0ed97d22ebff37cf7d9038 (diff)
downloadpostgresql-472f608e436a41865b795c999bda3369725fa097.tar.gz
postgresql-472f608e436a41865b795c999bda3369725fa097.zip
One more hack to make contrib upgrades from 9.0 match fresh 9.1 installs.
intarray and tsearch2 both reference core support functions in their GIN opclasses, and the signatures of those functions changed for 9.1. We added backwards-compatible pg_proc entries for the functions in order to allow 9.0 dump files to be restored at all, but that hack leaves the opclasses pointing at pg_proc entries different from what they'd point to if the contrib modules were installed fresh in 9.1. To forestall any possibility of future problems, fix the opclasses to match fresh installs via the expedient of direct UPDATEs on pg_amproc in the update-from-unpackaged scripts. (Yech ... but the alternatives are worse, or require far more effort than seems justified right now.) Note: updating pg_amproc is sufficient because there will be no pg_depend entries corresponding to these dependencies, since the referenced functions are all pinned.
-rw-r--r--contrib/intarray/intarray--unpackaged--1.0.sql18
-rw-r--r--contrib/tsearch2/tsearch2--unpackaged--1.0.sql41
2 files changed, 59 insertions, 0 deletions
diff --git a/contrib/intarray/intarray--unpackaged--1.0.sql b/contrib/intarray/intarray--unpackaged--1.0.sql
index 238ddfeea1b..5a2829c9f53 100644
--- a/contrib/intarray/intarray--unpackaged--1.0.sql
+++ b/contrib/intarray/intarray--unpackaged--1.0.sql
@@ -88,3 +88,21 @@ WHERE oid = 'ginint4_queryextract(internal,internal,smallint,internal,internal)'
UPDATE pg_catalog.pg_proc
SET pronargs = 8, proargtypes = '2281 21 2281 23 2281 2281 2281 2281'
WHERE oid = 'ginint4_consistent(internal,smallint,internal,integer,internal,internal)'::pg_catalog.regprocedure;
+
+-- intarray also relies on the core function ginarrayextract, which changed
+-- signature in 9.1. To support upgrading, pg_catalog contains entries
+-- for ginarrayextract with both 2 and 3 args, and the former is what would
+-- have been added to our opclass during initial restore of a 9.0 dump script.
+-- Avert your eyes while we hack the pg_amproc entry to make it link to the
+-- 3-arg form ...
+
+UPDATE pg_catalog.pg_amproc
+SET amproc = 'pg_catalog.ginarrayextract(anyarray,internal,internal)'::pg_catalog.regprocedure
+WHERE amprocfamily =
+ (SELECT oid FROM pg_catalog.pg_opfamily WHERE opfname = 'gin__int_ops' AND
+ opfnamespace = (SELECT oid FROM pg_catalog.pg_namespace
+ WHERE nspname = pg_catalog.current_schema()))
+ AND amproclefttype = 'integer[]'::pg_catalog.regtype
+ AND amprocrighttype = 'integer[]'::pg_catalog.regtype
+ AND amprocnum = 2
+ AND amproc = 'pg_catalog.ginarrayextract(anyarray,internal)'::pg_catalog.regprocedure;
diff --git a/contrib/tsearch2/tsearch2--unpackaged--1.0.sql b/contrib/tsearch2/tsearch2--unpackaged--1.0.sql
index a3fcc8572ab..d04d5aa57e3 100644
--- a/contrib/tsearch2/tsearch2--unpackaged--1.0.sql
+++ b/contrib/tsearch2/tsearch2--unpackaged--1.0.sql
@@ -98,3 +98,44 @@ ALTER EXTENSION tsearch2 ADD operator family @extschema@.tsvector_ops using btre
ALTER EXTENSION tsearch2 ADD operator class @extschema@.tsvector_ops using btree;
ALTER EXTENSION tsearch2 ADD operator family @extschema@.tsquery_ops using btree;
ALTER EXTENSION tsearch2 ADD operator class @extschema@.tsquery_ops using btree;
+
+-- tsearch2 relies on the core functions gin_extract_tsvector,
+-- gin_extract_tsquery, and gin_tsquery_consistent, which changed signature in
+-- 9.1. To support upgrading, pg_catalog contains entries for these functions
+-- with both the old and new signatures, and the former is what would have
+-- been added to our opclass during initial restore of a 9.0 dump script.
+-- Avert your eyes while we hack the pg_amproc entries to make them link to
+-- the new forms ...
+
+UPDATE pg_catalog.pg_amproc
+SET amproc = 'pg_catalog.gin_extract_tsvector(pg_catalog.tsvector,internal,internal)'::pg_catalog.regprocedure
+WHERE amprocfamily =
+ (SELECT oid FROM pg_catalog.pg_opfamily WHERE opfname = 'gin_tsvector_ops' AND
+ opfnamespace = (SELECT oid FROM pg_catalog.pg_namespace
+ WHERE nspname = '@extschema@'))
+ AND amproclefttype = 'pg_catalog.tsvector'::pg_catalog.regtype
+ AND amprocrighttype = 'pg_catalog.tsvector'::pg_catalog.regtype
+ AND amprocnum = 2
+ AND amproc = 'pg_catalog.gin_extract_tsvector(pg_catalog.tsvector,internal)'::pg_catalog.regprocedure;
+
+UPDATE pg_catalog.pg_amproc
+SET amproc = 'pg_catalog.gin_extract_tsquery(pg_catalog.tsquery,internal,smallint,internal,internal,internal,internal)'::pg_catalog.regprocedure
+WHERE amprocfamily =
+ (SELECT oid FROM pg_catalog.pg_opfamily WHERE opfname = 'gin_tsvector_ops' AND
+ opfnamespace = (SELECT oid FROM pg_catalog.pg_namespace
+ WHERE nspname = '@extschema@'))
+ AND amproclefttype = 'pg_catalog.tsvector'::pg_catalog.regtype
+ AND amprocrighttype = 'pg_catalog.tsvector'::pg_catalog.regtype
+ AND amprocnum = 3
+ AND amproc = 'pg_catalog.gin_extract_tsquery(pg_catalog.tsquery,internal,smallint,internal,internal)'::pg_catalog.regprocedure;
+
+UPDATE pg_catalog.pg_amproc
+SET amproc = 'pg_catalog.gin_tsquery_consistent(internal,smallint,pg_catalog.tsquery,integer,internal,internal,internal,internal)'::pg_catalog.regprocedure
+WHERE amprocfamily =
+ (SELECT oid FROM pg_catalog.pg_opfamily WHERE opfname = 'gin_tsvector_ops' AND
+ opfnamespace = (SELECT oid FROM pg_catalog.pg_namespace
+ WHERE nspname = '@extschema@'))
+ AND amproclefttype = 'pg_catalog.tsvector'::pg_catalog.regtype
+ AND amprocrighttype = 'pg_catalog.tsvector'::pg_catalog.regtype
+ AND amprocnum = 4
+ AND amproc = 'pg_catalog.gin_tsquery_consistent(internal,smallint,pg_catalog.tsquery,integer,internal,internal)'::pg_catalog.regprocedure;