mirror of
https://github.com/postgres/postgres.git
synced 2026-03-09 09:40:40 -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
ffe53037df
commit
e0a9c64635
4 changed files with 14 additions and 2 deletions
|
|
@ -1799,8 +1799,11 @@ EventTriggerCollectAlterTSConfig(AlterTSConfigurationStmt *stmt, Oid cfgId,
|
|||
command->in_extension = creating_extension;
|
||||
ObjectAddressSet(command->d.atscfg.address,
|
||||
TSConfigRelationId, cfgId);
|
||||
command->d.atscfg.dictIds = palloc(sizeof(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
|
||||
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