Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6595dd0

Browse files
committed
Add backwards-compatible declarations of some core GIN support functions.
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.
1 parent b15fabf commit 6595dd0

File tree

7 files changed

+72
-3
lines changed

7 files changed

+72
-3
lines changed

contrib/intarray/intarray--unpackaged--1.0.sql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ ALTER EXTENSION intarray ADD function g_intbig_union(internal,internal);
6565
ALTER EXTENSION intarray ADD function g_intbig_same(internal,internal,internal);
6666
ALTER EXTENSION intarray ADD operator family gist__intbig_ops using gist;
6767
ALTER EXTENSION intarray ADD operator class gist__intbig_ops using gist;
68-
ALTER EXTENSION intarray ADD function ginint4_queryextract(internal,internal,smallint,internal,internal,internal,internal);
69-
ALTER EXTENSION intarray ADD function ginint4_consistent(internal,smallint,internal,integer,internal,internal,internal,internal);
7068
ALTER EXTENSION intarray ADD operator family gin__int_ops using gin;
7169
ALTER EXTENSION intarray ADD operator class gin__int_ops using gin;
70+
71+
-- these two functions have different signatures in 9.1, but we don't
72+
-- bother trying to fix them because GIN doesn't care much
73+
ALTER EXTENSION intarray ADD function ginint4_queryextract(internal,internal,smallint,internal,internal);
74+
ALTER EXTENSION intarray ADD function ginint4_consistent(internal,smallint,internal,integer,internal,internal);

src/backend/access/gin/ginarrayproc.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ ginarrayextract(PG_FUNCTION_ARGS)
5858
PG_RETURN_POINTER(elems);
5959
}
6060

61+
/*
62+
* Formerly, ginarrayextract had only two arguments. Now it has three,
63+
* but we still need a pg_proc entry with two args to support reloading
64+
* pre-9.1 contrib/intarray opclass declarations. This compatibility
65+
* function should go away eventually.
66+
*/
67+
Datum
68+
ginarrayextract_2args(PG_FUNCTION_ARGS)
69+
{
70+
if (PG_NARGS() < 3) /* should not happen */
71+
elog(ERROR, "ginarrayextract requires three arguments");
72+
return ginarrayextract(fcinfo);
73+
}
74+
6175
/*
6276
* extractQuery support function
6377
*/

src/backend/utils/adt/tsginidx.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,43 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS)
230230

231231
PG_RETURN_BOOL(res);
232232
}
233+
234+
/*
235+
* Formerly, gin_extract_tsvector had only two arguments. Now it has three,
236+
* but we still need a pg_proc entry with two args to support reloading
237+
* pre-9.1 contrib/tsearch2 opclass declarations. This compatibility
238+
* function should go away eventually. (Note: you might say "hey, but the
239+
* code above is only *using* two args, so let's just declare it that way".
240+
* If you try that you'll find the opr_sanity regression test complains.)
241+
*/
242+
Datum
243+
gin_extract_tsvector_2args(PG_FUNCTION_ARGS)
244+
{
245+
if (PG_NARGS() < 3) /* should not happen */
246+
elog(ERROR, "gin_extract_tsvector requires three arguments");
247+
return gin_extract_tsvector(fcinfo);
248+
}
249+
250+
/*
251+
* Likewise, we need a stub version of gin_extract_tsquery declared with
252+
* only five arguments.
253+
*/
254+
Datum
255+
gin_extract_tsquery_5args(PG_FUNCTION_ARGS)
256+
{
257+
if (PG_NARGS() < 7) /* should not happen */
258+
elog(ERROR, "gin_extract_tsquery requires seven arguments");
259+
return gin_extract_tsquery(fcinfo);
260+
}
261+
262+
/*
263+
* Likewise, we need a stub version of gin_tsquery_consistent declared with
264+
* only six arguments.
265+
*/
266+
Datum
267+
gin_tsquery_consistent_6args(PG_FUNCTION_ARGS)
268+
{
269+
if (PG_NARGS() < 8) /* should not happen */
270+
elog(ERROR, "gin_tsquery_consistent requires eight arguments");
271+
return gin_tsquery_consistent(fcinfo);
272+
}

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@
5353
*/
5454

5555
/* yyyymmddN */
56-
#define CATALOG_VERSION_NO 201102141
56+
#define CATALOG_VERSION_NO 201102161
5757

5858
#endif

src/include/catalog/pg_proc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4407,6 +4407,8 @@ DATA(insert OID = 2774 ( ginqueryarrayextract PGNSP PGUID 12 1 0 0 f f f t f i
44074407
DESCR("GIN array support");
44084408
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_ ));
44094409
DESCR("GIN array support");
4410+
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_ ));
4411+
DESCR("GIN array support (obsolete)");
44104412

44114413
/* overlap/contains/contained */
44124414
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
46664668
DESCR("GIN tsvector support");
46674669
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_ ));
46684670
DESCR("GIN tsvector support");
4671+
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_ ));
4672+
DESCR("GIN tsvector support (obsolete)");
4673+
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_ ));
4674+
DESCR("GIN tsvector support (obsolete)");
4675+
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_ ));
4676+
DESCR("GIN tsvector support (obsolete)");
46694677

46704678
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_ ));
46714679
DESCR("less-than");

src/include/tsearch/ts_utils.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ extern Datum gin_cmp_tslexeme(PG_FUNCTION_ARGS);
149149
extern Datum gin_cmp_prefix(PG_FUNCTION_ARGS);
150150
extern Datum gin_extract_tsquery(PG_FUNCTION_ARGS);
151151
extern Datum gin_tsquery_consistent(PG_FUNCTION_ARGS);
152+
extern Datum gin_extract_tsvector_2args(PG_FUNCTION_ARGS);
153+
extern Datum gin_extract_tsquery_5args(PG_FUNCTION_ARGS);
154+
extern Datum gin_tsquery_consistent_6args(PG_FUNCTION_ARGS);
152155

153156
/*
154157
* Possible strategy numbers for indexes

src/include/utils/builtins.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@ extern Datum window_nth_value(PG_FUNCTION_ARGS);
10531053

10541054
/* access/gin/ginarrayproc.c */
10551055
extern Datum ginarrayextract(PG_FUNCTION_ARGS);
1056+
extern Datum ginarrayextract_2args(PG_FUNCTION_ARGS);
10561057
extern Datum ginqueryarrayextract(PG_FUNCTION_ARGS);
10571058
extern Datum ginarrayconsistent(PG_FUNCTION_ARGS);
10581059

0 commit comments

Comments
 (0)