From eb43e851d6b3fa0c4516efcfdf29a183f7717a43 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 2 Mar 2016 17:37:54 -0500 Subject: [PATCH] Create stub functions to support pg_upgrade of old contrib/tsearch2. Commits 9ff60273e35cad6e and dbe2328959e12701 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.) --- src/backend/utils/adt/tsginidx.c | 20 ++++++++++++++++++++ src/backend/utils/adt/tsgistidx.c | 13 +++++++++++++ src/backend/utils/adt/tsquery_gist.c | 13 +++++++++++++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.h | 9 +++++++++ src/include/tsearch/ts_utils.h | 4 ++++ 6 files changed, 60 insertions(+), 1 deletion(-) diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index 2819d520e94..fef594700aa 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -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); +} diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c index ede11ddd48c..0100cf4f372 100644 --- a/src/backend/utils/adt/tsgistidx.c +++ b/src/backend/utils/adt/tsgistidx.c @@ -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); +} diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c index 02693bd0ee8..5eebf216c07 100644 --- a/src/backend/utils/adt/tsquery_gist.c +++ b/src/backend/utils/adt/tsquery_gist.c @@ -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); +} diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 6795834912a..2f57524fcb2 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201603011 +#define CATALOG_VERSION_NO 201603021 #endif diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 62b91252dc5..aec6c4ca904 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -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"); diff --git a/src/include/tsearch/ts_utils.h b/src/include/tsearch/ts_utils.h index 3b886b3c72b..88533a64235 100644 --- a/src/include/tsearch/ts_utils.h +++ b/src/include/tsearch/ts_utils.h @@ -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