Add backwards-compatible declarations of some core GIN support functions.
authorTom Lane
Wed, 16 Feb 2011 22:24:06 +0000 (17:24 -0500)
committerTom Lane
Wed, 16 Feb 2011 22:24:46 +0000 (17:24 -0500)
These are needed to support reloading dumps of 9.0 installations containing
contrib/intarray or contrib/tsearch2.  Since not only regular dump/reload
but binary upgrade would fail, it seems worth the trouble to carry these
stubs for awhile.  Note that the contrib opclasses referencing these
functions will still work fine, since GIN doesn't actually pay any
attention to the declared signature of a support function.

contrib/intarray/intarray--unpackaged--1.0.sql
src/backend/access/gin/ginarrayproc.c
src/backend/utils/adt/tsginidx.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/tsearch/ts_utils.h
src/include/utils/builtins.h

index 7fd739b0ed44e71cd9b2acdd745709a67f91c55f..69bdc589b6240640797e4b64608cd923369887b8 100644 (file)
@@ -65,7 +65,10 @@ ALTER EXTENSION intarray ADD function g_intbig_union(internal,internal);
 ALTER EXTENSION intarray ADD function g_intbig_same(internal,internal,internal);
 ALTER EXTENSION intarray ADD operator family gist__intbig_ops using gist;
 ALTER EXTENSION intarray ADD operator class gist__intbig_ops using gist;
-ALTER EXTENSION intarray ADD function ginint4_queryextract(internal,internal,smallint,internal,internal,internal,internal);
-ALTER EXTENSION intarray ADD function ginint4_consistent(internal,smallint,internal,integer,internal,internal,internal,internal);
 ALTER EXTENSION intarray ADD operator family gin__int_ops using gin;
 ALTER EXTENSION intarray ADD operator class gin__int_ops using gin;
+
+-- these two functions have different signatures in 9.1, but we don't
+-- bother trying to fix them because GIN doesn't care much
+ALTER EXTENSION intarray ADD function ginint4_queryextract(internal,internal,smallint,internal,internal);
+ALTER EXTENSION intarray ADD function ginint4_consistent(internal,smallint,internal,integer,internal,internal);
index 2100c5fd0e48ca11d8768affd616a6fcf93ee5cf..ce9abae6aa4ac3f740f9e6980391a7cbdf972c98 100644 (file)
@@ -58,6 +58,20 @@ ginarrayextract(PG_FUNCTION_ARGS)
    PG_RETURN_POINTER(elems);
 }
 
+/*
+ * Formerly, ginarrayextract had only two arguments.  Now it has three,
+ * but we still need a pg_proc entry with two args to support reloading
+ * pre-9.1 contrib/intarray opclass declarations.  This compatibility
+ * function should go away eventually.
+ */
+Datum
+ginarrayextract_2args(PG_FUNCTION_ARGS)
+{
+   if (PG_NARGS() < 3)         /* should not happen */
+       elog(ERROR, "ginarrayextract requires three arguments");
+   return ginarrayextract(fcinfo);
+}
+
 /*
  * extractQuery support function
  */
index 56cd9b70d28b715268046f10216edbdcf05ecba5..41700bfcf157d7061434d627c6d8b6196dc75685 100644 (file)
@@ -230,3 +230,43 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS)
 
    PG_RETURN_BOOL(res);
 }
+
+/*
+ * Formerly, gin_extract_tsvector had only two arguments.  Now it has three,
+ * but we still need a pg_proc entry with two args to support reloading
+ * pre-9.1 contrib/tsearch2 opclass declarations.  This compatibility
+ * function should go away eventually.  (Note: you might say "hey, but the
+ * code above is only *using* two args, so let's just declare it that way".
+ * If you try that you'll find the opr_sanity regression test complains.)
+ */
+Datum
+gin_extract_tsvector_2args(PG_FUNCTION_ARGS)
+{
+   if (PG_NARGS() < 3)         /* should not happen */
+       elog(ERROR, "gin_extract_tsvector requires three arguments");
+   return gin_extract_tsvector(fcinfo);
+}
+
+/*
+ * Likewise, we need a stub version of gin_extract_tsquery declared with
+ * only five arguments.
+ */
+Datum
+gin_extract_tsquery_5args(PG_FUNCTION_ARGS)
+{
+   if (PG_NARGS() < 7)         /* should not happen */
+       elog(ERROR, "gin_extract_tsquery requires seven arguments");
+   return gin_extract_tsquery(fcinfo);
+}
+
+/*
+ * Likewise, we need a stub version of gin_tsquery_consistent declared with
+ * only six arguments.
+ */
+Datum
+gin_tsquery_consistent_6args(PG_FUNCTION_ARGS)
+{
+   if (PG_NARGS() < 8)         /* should not happen */
+       elog(ERROR, "gin_tsquery_consistent requires eight arguments");
+   return gin_tsquery_consistent(fcinfo);
+}
index 464a06ac9938efcd1dec18f4ab3cf5d008085f4a..9d702674b8c3b740491121c7e1e98d5ba4ef6c2d 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 201102141
+#define CATALOG_VERSION_NO 201102161
 
 #endif
index a8598855bf896471bde2ae263e420ecaa08a5bb8..a16c66765d0c7557e4aaae7bb8417eb765cd0356 100644 (file)
@@ -4407,6 +4407,8 @@ DATA(insert OID = 2774 (  ginqueryarrayextract    PGNSP PGUID 12 1 0 0 f f f t f i
 DESCR("GIN array support");
 DATA(insert OID = 2744 (  ginarrayconsistent   PGNSP PGUID 12 1 0 0 f f f t f i 8 0 16 "2281 21 2277 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ ginarrayconsistent _null_ _null_ _null_ ));
 DESCR("GIN array support");
+DATA(insert OID = 3076 (  ginarrayextract   PGNSP PGUID 12 1 0 0 f f f t f i 2 0 2281 "2277 2281" _null_ _null_ _null_ _null_  ginarrayextract_2args _null_ _null_ _null_ ));
+DESCR("GIN array support (obsolete)");
 
 /* overlap/contains/contained */
 DATA(insert OID = 2747 (  arrayoverlap        PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "2277 2277" _null_ _null_ _null_ _null_ arrayoverlap _null_ _null_ _null_ ));
@@ -4666,6 +4668,12 @@ DATA(insert OID = 3724 (  gin_cmp_tslexeme       PGNSP PGUID 12 1 0 0 f f f t f i 2 0
 DESCR("GIN tsvector support");
 DATA(insert OID = 2700 (  gin_cmp_prefix       PGNSP PGUID 12 1 0 0 f f f t f i 4 0 23 "25 25 21 2281" _null_ _null_ _null_ _null_ gin_cmp_prefix _null_ _null_ _null_ ));
 DESCR("GIN tsvector support");
+DATA(insert OID = 3077 (  gin_extract_tsvector PGNSP PGUID 12 1 0 0 f f f t f i 2 0 2281 "3614 2281" _null_ _null_ _null_ _null_   gin_extract_tsvector_2args _null_ _null_ _null_ ));
+DESCR("GIN tsvector support (obsolete)");
+DATA(insert OID = 3087 (  gin_extract_tsquery  PGNSP PGUID 12 1 0 0 f f f t f i 5 0 2281 "3615 2281 21 2281 2281" _null_ _null_ _null_ _null_ gin_extract_tsquery_5args _null_ _null_ _null_ ));
+DESCR("GIN tsvector support (obsolete)");
+DATA(insert OID = 3088 (  gin_tsquery_consistent PGNSP PGUID 12 1 0 0 f f f t f i 6 0 16 "2281 21 3615 23 2281 2281" _null_ _null_ _null_ _null_   gin_tsquery_consistent_6args _null_ _null_ _null_ ));
+DESCR("GIN tsvector support (obsolete)");
 
 DATA(insert OID = 3662 (  tsquery_lt           PGNSP PGUID 12 1 0 0 f f f t f i 2 0 16 "3615 3615" _null_ _null_ _null_ _null_ tsquery_lt _null_ _null_ _null_ ));
 DESCR("less-than");
index 1bd40344881a958fac324e9c51aac83d6c52faf0..9c1019f49aefb0eca5a12e62f84f5cdfbdd97f71 100644 (file)
@@ -149,6 +149,9 @@ extern Datum gin_cmp_tslexeme(PG_FUNCTION_ARGS);
 extern Datum gin_cmp_prefix(PG_FUNCTION_ARGS);
 extern Datum gin_extract_tsquery(PG_FUNCTION_ARGS);
 extern Datum gin_tsquery_consistent(PG_FUNCTION_ARGS);
+extern Datum gin_extract_tsvector_2args(PG_FUNCTION_ARGS);
+extern Datum gin_extract_tsquery_5args(PG_FUNCTION_ARGS);
+extern Datum gin_tsquery_consistent_6args(PG_FUNCTION_ARGS);
 
 /*
  * Possible strategy numbers for indexes
index c3eb67b40193c40c2b1a7d9a3513ee377dcf1553..4341025d06a9ae50b36e8f38bb0ddc8a28237509 100644 (file)
@@ -1053,6 +1053,7 @@ extern Datum window_nth_value(PG_FUNCTION_ARGS);
 
 /* access/gin/ginarrayproc.c */
 extern Datum ginarrayextract(PG_FUNCTION_ARGS);
+extern Datum ginarrayextract_2args(PG_FUNCTION_ARGS);
 extern Datum ginqueryarrayextract(PG_FUNCTION_ARGS);
 extern Datum ginarrayconsistent(PG_FUNCTION_ARGS);