Create stub functions to support pg_upgrade of old contrib/tsearch2.

Commits 9ff60273e3 and dbe2328959 adjusted the declarations
of some core functions referenced by contrib/tsearch2's install script,
forgetting that in a pg_upgrade situation, we'll be trying to restore
operator class definitions that reference the old signatures.  We've
hit this problem before; solve it in the same way as before, namely by
installing stub functions that have the expected signature and just
invoke the correct function.  Per report from Jeff Janes.

(Someday we ought to stop supporting contrib/tsearch2, but I'm not
sure today is that day.)
This commit is contained in:
Tom Lane 2016-03-02 17:37:54 -05:00
parent cc6077d4d5
commit eb43e851d6
6 changed files with 60 additions and 1 deletions

View File

@ -377,3 +377,23 @@ gin_tsquery_consistent_6args(PG_FUNCTION_ARGS)
elog(ERROR, "gin_tsquery_consistent requires eight arguments");
return gin_tsquery_consistent(fcinfo);
}
/*
* Likewise, a stub version of gin_extract_tsquery declared with argument
* types that are no longer considered appropriate.
*/
Datum
gin_extract_tsquery_oldsig(PG_FUNCTION_ARGS)
{
return gin_extract_tsquery(fcinfo);
}
/*
* Likewise, a stub version of gin_tsquery_consistent declared with argument
* types that are no longer considered appropriate.
*/
Datum
gin_tsquery_consistent_oldsig(PG_FUNCTION_ARGS)
{
return gin_tsquery_consistent(fcinfo);
}

View File

@ -805,3 +805,16 @@ gtsvector_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(v);
}
/*
* Formerly, gtsvector_consistent was declared in pg_proc.h with arguments
* that did not match the documented conventions for GiST support functions.
* We fixed that, but we still need a pg_proc entry with the old signature
* to support reloading pre-9.6 contrib/tsearch2 opclass declarations.
* This compatibility function should go away eventually.
*/
Datum
gtsvector_consistent_oldsig(PG_FUNCTION_ARGS)
{
return gtsvector_consistent(fcinfo);
}

View File

@ -262,3 +262,16 @@ gtsquery_picksplit(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(v);
}
/*
* Formerly, gtsquery_consistent was declared in pg_proc.h with arguments
* that did not match the documented conventions for GiST support functions.
* We fixed that, but we still need a pg_proc entry with the old signature
* to support reloading pre-9.6 contrib/tsearch2 opclass declarations.
* This compatibility function should go away eventually.
*/
Datum
gtsquery_consistent_oldsig(PG_FUNCTION_ARGS)
{
return gtsquery_consistent(fcinfo);
}

View File

@ -53,6 +53,6 @@
*/
/* yyyymmddN */
#define CATALOG_VERSION_NO 201603011
#define CATALOG_VERSION_NO 201603021
#endif

View File

@ -4516,6 +4516,8 @@ DATA(insert OID = 3653 ( gtsvector_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f
DESCR("GiST tsvector support");
DATA(insert OID = 3654 ( gtsvector_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3614 21 26 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_consistent _null_ _null_ _null_ ));
DESCR("GiST tsvector support");
DATA(insert OID = 3790 ( gtsvector_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3642 23 26 2281" _null_ _null_ _null_ _null_ _null_ gtsvector_consistent_oldsig _null_ _null_ _null_ ));
DESCR("GiST tsvector support (obsolete)");
DATA(insert OID = 3656 ( gin_extract_tsvector PGNSP PGUID 12 1 0 0 0 f f f f t f i s 3 0 2281 "3614 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_tsvector _null_ _null_ _null_ ));
DESCR("GIN tsvector support");
@ -4535,6 +4537,11 @@ DATA(insert OID = 3087 ( gin_extract_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f
DESCR("GIN tsvector support (obsolete)");
DATA(insert OID = 3088 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 6 0 16 "2281 21 3615 23 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_tsquery_consistent_6args _null_ _null_ _null_ ));
DESCR("GIN tsvector support (obsolete)");
DATA(insert OID = 3791 ( gin_extract_tsquery PGNSP PGUID 12 1 0 0 0 f f f f t f i s 7 0 2281 "3615 2281 21 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_extract_tsquery_oldsig _null_ _null_ _null_ ));
DESCR("GIN tsvector support (obsolete)");
DATA(insert OID = 3792 ( gin_tsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 8 0 16 "2281 21 3615 23 2281 2281 2281 2281" _null_ _null_ _null_ _null_ _null_ gin_tsquery_consistent_oldsig _null_ _null_ _null_ ));
DESCR("GIN tsvector support (obsolete)");
DATA(insert OID = 3789 ( gin_clean_pending_list PGNSP PGUID 12 1 0 0 0 f f f f t f v s 1 0 20 "2205" _null_ _null_ _null_ _null_ _null_ gin_clean_pending_list _null_ _null_ _null_ ));
DESCR("clean up GIN pending list");
@ -4578,6 +4585,8 @@ DATA(insert OID = 3700 ( gtsquery_penalty PGNSP PGUID 12 1 0 0 0 f f f f t f
DESCR("GiST tsquery support");
DATA(insert OID = 3701 ( gtsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 3615 21 26 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_consistent _null_ _null_ _null_ ));
DESCR("GiST tsquery support");
DATA(insert OID = 3793 ( gtsquery_consistent PGNSP PGUID 12 1 0 0 0 f f f f t f i s 5 0 16 "2281 2281 23 26 2281" _null_ _null_ _null_ _null_ _null_ gtsquery_consistent_oldsig _null_ _null_ _null_ ));
DESCR("GiST tsquery support (obsolete)");
DATA(insert OID = 3686 ( tsmatchsel PGNSP PGUID 12 1 0 0 0 f f f f t f s s 4 0 701 "2281 26 2281 23" _null_ _null_ _null_ _null_ _null_ tsmatchsel _null_ _null_ _null_ ));
DESCR("restriction selectivity of tsvector @@ tsquery");

View File

@ -132,6 +132,7 @@ extern Datum gtsvector_union(PG_FUNCTION_ARGS);
extern Datum gtsvector_same(PG_FUNCTION_ARGS);
extern Datum gtsvector_penalty(PG_FUNCTION_ARGS);
extern Datum gtsvector_picksplit(PG_FUNCTION_ARGS);
extern Datum gtsvector_consistent_oldsig(PG_FUNCTION_ARGS);
/*
* IO functions for pseudotype gtsvector
@ -153,6 +154,8 @@ extern Datum gin_tsquery_triconsistent(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);
extern Datum gin_extract_tsquery_oldsig(PG_FUNCTION_ARGS);
extern Datum gin_tsquery_consistent_oldsig(PG_FUNCTION_ARGS);
/*
* Possible strategy numbers for indexes
@ -217,6 +220,7 @@ extern Datum gtsquery_union(PG_FUNCTION_ARGS);
extern Datum gtsquery_same(PG_FUNCTION_ARGS);
extern Datum gtsquery_penalty(PG_FUNCTION_ARGS);
extern Datum gtsquery_picksplit(PG_FUNCTION_ARGS);
extern Datum gtsquery_consistent_oldsig(PG_FUNCTION_ARGS);
/*
* Parser interface to SQL