1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

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.
This commit is contained in:
Tom Lane
2011-02-16 17:24:06 -05:00
parent b15fabf997
commit 6595dd04d1
7 changed files with 72 additions and 3 deletions

View 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
*/

View 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);
}