mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03: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:
@@ -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(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
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user