mirror of
https://github.com/postgres/postgres.git
synced 2026-03-23 10:55:21 -04:00
Don't malloc(0) in EventTriggerCollectAlterTSConfig
Author: Florin Irion <florin.irion@enterprisedb.com> Discussion: https://postgr.es/m/c6fff161-9aee-4290-9ada-71e21e4d84de@gmail.com
This commit is contained in:
parent
fd366065e0
commit
ce4fbe1ac6
5 changed files with 15 additions and 2 deletions
|
|
@ -2004,8 +2004,11 @@ EventTriggerCollectAlterTSConfig(AlterTSConfigurationStmt *stmt, Oid cfgId,
|
|||
command->in_extension = creating_extension;
|
||||
ObjectAddressSet(command->d.atscfg.address,
|
||||
TSConfigRelationId, cfgId);
|
||||
command->d.atscfg.dictIds = palloc_array(Oid, ndicts);
|
||||
memcpy(command->d.atscfg.dictIds, dictIds, sizeof(Oid) * ndicts);
|
||||
if (ndicts > 0)
|
||||
{
|
||||
command->d.atscfg.dictIds = palloc_array(Oid, ndicts);
|
||||
memcpy(command->d.atscfg.dictIds, dictIds, sizeof(Oid) * ndicts);
|
||||
}
|
||||
command->d.atscfg.ndicts = ndicts;
|
||||
command->parsetree = (Node *) copyObject(stmt);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ REGRESS = test_ddl_deparse \
|
|||
alter_type_enum \
|
||||
opfamily \
|
||||
defprivs \
|
||||
textsearch \
|
||||
matviews
|
||||
|
||||
EXTRA_INSTALL = contrib/pg_stat_statements
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TEXT SEARCH CONFIGURATION evttrig_tscfg (COPY = pg_catalog.simple);
|
||||
NOTICE: DDL test: type simple, tag CREATE TEXT SEARCH CONFIGURATION
|
||||
ALTER TEXT SEARCH CONFIGURATION evttrig_tscfg
|
||||
DROP MAPPING FOR word;
|
||||
NOTICE: DDL test: type alter text search configuration, tag ALTER TEXT SEARCH CONFIGURATION
|
||||
|
|
@ -47,6 +47,7 @@ tests += {
|
|||
'alter_type_enum',
|
||||
'opfamily',
|
||||
'defprivs',
|
||||
'textsearch',
|
||||
'matviews',
|
||||
],
|
||||
},
|
||||
|
|
|
|||
3
src/test/modules/test_ddl_deparse/sql/textsearch.sql
Normal file
3
src/test/modules/test_ddl_deparse/sql/textsearch.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
CREATE TEXT SEARCH CONFIGURATION evttrig_tscfg (COPY = pg_catalog.simple);
|
||||
ALTER TEXT SEARCH CONFIGURATION evttrig_tscfg
|
||||
DROP MAPPING FOR word;
|
||||
Loading…
Reference in a new issue