Skip to content

Commit 12bd7dd

Browse files
committed
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.
1 parent 1ead020 commit 12bd7dd

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

src/backend/commands/tsearchcmds.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1215,10 +1215,10 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
12151215
/* Update dependencies */
12161216
makeConfigurationDependencies(tup, true, relMap);
12171217

1218-
InvokeObjectPostAlterHook(TSConfigMapRelationId,
1218+
InvokeObjectPostAlterHook(TSConfigRelationId,
12191219
HeapTupleGetOid(tup), 0);
12201220

1221-
ObjectAddressSet(address, TSConfigMapRelationId, cfgId);
1221+
ObjectAddressSet(address, TSConfigRelationId, cfgId);
12221222

12231223
heap_close(relMap, RowExclusiveLock);
12241224

src/backend/tcop/utility.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,13 @@ ProcessUtilitySlow(ParseState *pstate,
14791479
break;
14801480

14811481
case T_AlterTSConfigurationStmt:
1482-
address = AlterTSConfiguration((AlterTSConfigurationStmt *) parsetree);
1482+
AlterTSConfiguration((AlterTSConfigurationStmt *) parsetree);
1483+
/*
1484+
* Commands are stashed in MakeConfigurationMapping and
1485+
* DropConfigurationMapping, which are called from
1486+
* AlterTSConfiguration
1487+
*/
1488+
commandCollected = true;
14831489
break;
14841490

14851491
case T_AlterTableMoveAllStmt:

src/test/modules/test_ddl_deparse/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ REGRESS = test_ddl_deparse \
2323
comment_on \
2424
alter_function \
2525
alter_sequence \
26+
alter_ts_config \
2627
alter_type_enum \
2728
opfamily \
2829
defprivs \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--
2+
-- ALTER TEXT SEARCH CONFIGURATION
3+
--
4+
CREATE TEXT SEARCH CONFIGURATION en (copy=english);
5+
NOTICE: DDL test: type simple, tag CREATE TEXT SEARCH CONFIGURATION
6+
ALTER TEXT SEARCH CONFIGURATION en
7+
ALTER MAPPING FOR host, email, url, sfloat WITH simple;
8+
NOTICE: DDL test: type alter text search configuration, tag ALTER TEXT SEARCH CONFIGURATION
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
--
2+
-- ALTER TEXT SEARCH CONFIGURATION
3+
--
4+
5+
CREATE TEXT SEARCH CONFIGURATION en (copy=english);
6+
7+
ALTER TEXT SEARCH CONFIGURATION en
8+
ALTER MAPPING FOR host, email, url, sfloat WITH simple;

0 commit comments

Comments
 (0)