Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6595dd0

Browse files
committed
Add backwards-compatible declarations of some core GIN support functions.
These are needed to support reloading dumps of 9.0 installations containingcontrib/intarray or contrib/tsearch2. Since not only regular dump/reloadbut binary upgrade would fail, it seems worth the trouble to carry thesestubs for awhile. Note that the contrib opclasses referencing thesefunctions will still work fine, since GIN doesn't actually pay anyattention to the declared signature of a support function.
1 parentb15fabf commit6595dd0

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+
returnginarrayextract(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+
returngin_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+
returngin_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+
returngin_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-
#defineCATALOG_VERSION_NO201102141
56+
#defineCATALOG_VERSION_NO201102161
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 ( ginqueryarrayextractPGNSP PGUID 12 1 0 0 f f f t f i
44074407
DESCR("GIN array support");
44084408
DATA(insertOID=2744 (ginarrayconsistentPGNSPPGUID12100ffftfi8016"2281 21 2277 23 2281 2281 2281 2281"_null__null__null__null_ginarrayconsistent_null__null__null_ ));
44094409
DESCR("GIN array support");
4410+
DATA(insertOID=3076 (ginarrayextractPGNSPPGUID12100ffftfi202281"2277 2281"_null__null__null__null_ginarrayextract_2args_null__null__null_ ));
4411+
DESCR("GIN array support (obsolete)");
44104412

44114413
/* overlap/contains/contained */
44124414
DATA(insertOID=2747 (arrayoverlapPGNSPPGUID12100ffftfi2016"2277 2277"_null__null__null__null_arrayoverlap_null__null__null_ ));
@@ -4666,6 +4668,12 @@ DATA(insert OID = 3724 ( gin_cmp_tslexemePGNSP PGUID 12 1 0 0 f f f t f i 2 0
46664668
DESCR("GIN tsvector support");
46674669
DATA(insertOID=2700 (gin_cmp_prefixPGNSPPGUID12100ffftfi4023"25 25 21 2281"_null__null__null__null_gin_cmp_prefix_null__null__null_ ));
46684670
DESCR("GIN tsvector support");
4671+
DATA(insertOID=3077 (gin_extract_tsvectorPGNSPPGUID12100ffftfi202281"3614 2281"_null__null__null__null_gin_extract_tsvector_2args_null__null__null_ ));
4672+
DESCR("GIN tsvector support (obsolete)");
4673+
DATA(insertOID=3087 (gin_extract_tsqueryPGNSPPGUID12100ffftfi502281"3615 2281 21 2281 2281"_null__null__null__null_gin_extract_tsquery_5args_null__null__null_ ));
4674+
DESCR("GIN tsvector support (obsolete)");
4675+
DATA(insertOID=3088 (gin_tsquery_consistentPGNSPPGUID12100ffftfi6016"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(insertOID=3662 (tsquery_ltPGNSPPGUID12100ffftfi2016"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
externDatumgin_cmp_prefix(PG_FUNCTION_ARGS);
150150
externDatumgin_extract_tsquery(PG_FUNCTION_ARGS);
151151
externDatumgin_tsquery_consistent(PG_FUNCTION_ARGS);
152+
externDatumgin_extract_tsvector_2args(PG_FUNCTION_ARGS);
153+
externDatumgin_extract_tsquery_5args(PG_FUNCTION_ARGS);
154+
externDatumgin_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
externDatumginarrayextract(PG_FUNCTION_ARGS);
1056+
externDatumginarrayextract_2args(PG_FUNCTION_ARGS);
10561057
externDatumginqueryarrayextract(PG_FUNCTION_ARGS);
10571058
externDatumginarrayconsistent(PG_FUNCTION_ARGS);
10581059

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp