Commit 12bd7dd3 authored by Stephen Frost's avatar Stephen Frost

Use TSConfigRelationId in AlterTSConfiguration()

When we are altering a text search configuration, we are getting the
tuple from pg_ts_config and using its OID, so use TSConfigRelationId
when invoking any post-alter hooks and setting the object address.

Further, in the functions called from AlterTSConfiguration(), we're
saving information about the command via
EventTriggerCollectAlterTSConfig(), so we should be setting
commandCollected to true.  Also add a regression test to
test_ddl_deparse for ALTER TEXT SEARCH CONFIGURATION.

Author: Artur Zakirov, a few additional comments by me
Discussion: https://www.postgresql.org/message-id/57a71eba-f2c7-e7fd-6fc0-2126ec0b39bd%40postgrespro.ru

Back-patch the fix for the InvokeObjectPostAlterHook() call to 9.3 where
it was introduced, and the fix for the ObjectAddressSet() call and
setting commandCollected to true to 9.5 where those changes to
ProcessUtilitySlow() were introduced.
parent 1ead0208
...@@ -1215,10 +1215,10 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt) ...@@ -1215,10 +1215,10 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
/* Update dependencies */ /* Update dependencies */
makeConfigurationDependencies(tup, true, relMap); makeConfigurationDependencies(tup, true, relMap);
InvokeObjectPostAlterHook(TSConfigMapRelationId, InvokeObjectPostAlterHook(TSConfigRelationId,
HeapTupleGetOid(tup), 0); HeapTupleGetOid(tup), 0);
ObjectAddressSet(address, TSConfigMapRelationId, cfgId); ObjectAddressSet(address, TSConfigRelationId, cfgId);
heap_close(relMap, RowExclusiveLock); heap_close(relMap, RowExclusiveLock);
......
...@@ -1479,7 +1479,13 @@ ProcessUtilitySlow(ParseState *pstate, ...@@ -1479,7 +1479,13 @@ ProcessUtilitySlow(ParseState *pstate,
break; break;
case T_AlterTSConfigurationStmt: case T_AlterTSConfigurationStmt:
address = AlterTSConfiguration((AlterTSConfigurationStmt *) parsetree); AlterTSConfiguration((AlterTSConfigurationStmt *) parsetree);
/*
* Commands are stashed in MakeConfigurationMapping and
* DropConfigurationMapping, which are called from
* AlterTSConfiguration
*/
commandCollected = true;
break; break;
case T_AlterTableMoveAllStmt: case T_AlterTableMoveAllStmt:
......
...@@ -23,6 +23,7 @@ REGRESS = test_ddl_deparse \ ...@@ -23,6 +23,7 @@ REGRESS = test_ddl_deparse \
comment_on \ comment_on \
alter_function \ alter_function \
alter_sequence \ alter_sequence \
alter_ts_config \
alter_type_enum \ alter_type_enum \
opfamily \ opfamily \
defprivs \ defprivs \
......
--
-- ALTER TEXT SEARCH CONFIGURATION
--
CREATE TEXT SEARCH CONFIGURATION en (copy=english);
NOTICE: DDL test: type simple, tag CREATE TEXT SEARCH CONFIGURATION
ALTER TEXT SEARCH CONFIGURATION en
ALTER MAPPING FOR host, email, url, sfloat WITH simple;
NOTICE: DDL test: type alter text search configuration, tag ALTER TEXT SEARCH CONFIGURATION
--
-- ALTER TEXT SEARCH CONFIGURATION
--
CREATE TEXT SEARCH CONFIGURATION en (copy=english);
ALTER TEXT SEARCH CONFIGURATION en
ALTER MAPPING FOR host, email, url, sfloat WITH simple;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment