Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f0f2e56

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 68330c8 commit f0f2e56

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
@@ -1467,7 +1467,13 @@ ProcessUtilitySlow(Node *parsetree,
14671467
break;
14681468

14691469
case T_AlterTSConfigurationStmt:
1470-
address = AlterTSConfiguration((AlterTSConfigurationStmt *) parsetree);
1470+
AlterTSConfiguration((AlterTSConfigurationStmt *) parsetree);
1471+
/*
1472+
* Commands are stashed in MakeConfigurationMapping and
1473+
* DropConfigurationMapping, which are called from
1474+
* AlterTSConfiguration
1475+
*/
1476+
commandCollected = true;
14711477
break;
14721478

14731479
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)