>From 40f727d4a444d0395a7cca0ba17e70d53305391c Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 16 Mar 2015 17:51:03 -0300 Subject: [PATCH 01/37] add secondaryOid to DefineTSConfiguration() In the spirit of a2e35b53c39: we need an extra output argument to know about a tsconfig referenced in the COPY clause of CREATE TS CONFIG. --- src/backend/commands/tsearchcmds.c | 10 +++++++++- src/include/commands/defrem.h | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c index 45bafd3..4c404e7 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -964,7 +964,7 @@ makeConfigurationDependencies(HeapTuple tuple, bool removeOld, * CREATE TEXT SEARCH CONFIGURATION */ ObjectAddress -DefineTSConfiguration(List *names, List *parameters) +DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied) { Relation cfgRel; Relation mapRel = NULL; @@ -1013,6 +1013,14 @@ DefineTSConfiguration(List *names, List *parameters) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("cannot specify both PARSER and COPY options"))); + /* make copied tsconfig available to callers */ + if (copied && OidIsValid(sourceOid)) + { + ObjectAddressSet(*copied, + TSConfigRelationId, + sourceOid); + } + /* * Look up source config if given. */ diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index a9c6783..595f93f 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -101,7 +101,8 @@ extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt); extern ObjectAddress DefineTSTemplate(List *names, List *parameters); extern void RemoveTSTemplateById(Oid tmplId); -extern ObjectAddress DefineTSConfiguration(List *names, List *parameters); +extern ObjectAddress DefineTSConfiguration(List *names, List *parameters, + ObjectAddress *copied); extern void RemoveTSConfigurationById(Oid cfgId); extern ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt); -- 2.1.4