diff --git a/contrib/intarray/intarray--unpackaged--1.0.sql b/contrib/intarray/intarray--unpackaged--1.0.sql index 7fd739b0ed4..69bdc589b62 100644 --- a/contrib/intarray/intarray--unpackaged--1.0.sql +++ b/contrib/intarray/intarray--unpackaged--1.0.sql @@ -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); diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c index 2100c5fd0e4..ce9abae6aa4 100644 --- a/src/backend/access/gin/ginarrayproc.c +++ b/src/backend/access/gin/ginarrayproc.c @@ -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 */ diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index 56cd9b70d28..41700bfcf15 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -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); +} diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 464a06ac993..9d702674b8c 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201102141 +#define CATALOG_VERSION_NO 201102161 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index a8598855bf8..a16c66765d0 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -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"); diff --git a/src/include/tsearch/ts_utils.h b/src/include/tsearch/ts_utils.h index 1bd40344881..9c1019f49ae 100644 --- a/src/include/tsearch/ts_utils.h +++ b/src/include/tsearch/ts_utils.h @@ -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 diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index c3eb67b4019..4341025d06a 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -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);