Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fd33d90

Browse filesBrowse files
committed
Simplify CREATE TEXT SEARCH CONFIGURATION by eliminating the separate
'with map' parameter; as things now stand there's really not much point in specifying a config-to-copy if you don't copy its map. Also, use COPY instead of TEMPLATE as the key word for a config-to-copy, so as to avoid confusion with text search templates. Per discussion; the just-committed reference page for the command already describes it this way.
1 parent 3e3bb36 commit fd33d90
Copy full SHA for fd33d90

File tree

Expand file treeCollapse file tree

1 file changed

+14
-19
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-19
lines changed

‎src/backend/commands/tsearchcmds.c

Copy file name to clipboardExpand all lines: src/backend/commands/tsearchcmds.c
+14-19Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.1 2007/08/21 01:11:15 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.2 2007/08/21 21:24:00 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -1192,10 +1192,9 @@ DefineTSConfiguration(List *names, List *parameters)
11921192
Oid namespaceoid;
11931193
char *cfgname;
11941194
NameData cname;
1195-
List *templateName = NIL;
1196-
Oid templateOid = InvalidOid;
1195+
List *sourceName = NIL;
1196+
Oid sourceOid = InvalidOid;
11971197
Oid prsOid = InvalidOid;
1198-
bool with_map = false;
11991198
Oid cfgOid;
12001199
ListCell *pl;
12011200

@@ -1217,10 +1216,8 @@ DefineTSConfiguration(List *names, List *parameters)
12171216

12181217
if (pg_strcasecmp(defel->defname, "parser") == 0)
12191218
prsOid = TSParserGetPrsid(defGetQualifiedName(defel), false);
1220-
else if (pg_strcasecmp(defel->defname, "template") == 0)
1221-
templateName = defGetQualifiedName(defel);
1222-
else if (pg_strcasecmp(defel->defname, "map") == 0)
1223-
with_map = defGetBoolean(defel);
1219+
else if (pg_strcasecmp(defel->defname, "copy") == 0)
1220+
sourceName = defGetQualifiedName(defel);
12241221
else
12251222
ereport(ERROR,
12261223
(errcode(ERRCODE_SYNTAX_ERROR),
@@ -1229,26 +1226,24 @@ DefineTSConfiguration(List *names, List *parameters)
12291226
}
12301227

12311228
/*
1232-
* Look up template if given. XXX the "template" is an existing config
1233-
* that we copy, not a pg_ts_template entry. This seems confusing.
1234-
* Maybe should use "source" or some other word?
1229+
* Look up source config if given.
12351230
*/
1236-
if (templateName)
1231+
if (sourceName)
12371232
{
12381233
Form_pg_ts_config cfg;
12391234

1240-
templateOid = TSConfigGetCfgid(templateName, false);
1235+
sourceOid = TSConfigGetCfgid(sourceName, false);
12411236

12421237
tup = SearchSysCache(TSCONFIGOID,
1243-
ObjectIdGetDatum(templateOid),
1238+
ObjectIdGetDatum(sourceOid),
12441239
0, 0, 0);
12451240
if (!HeapTupleIsValid(tup))
12461241
elog(ERROR, "cache lookup failed for text search configuration %u",
1247-
templateOid);
1242+
sourceOid);
12481243

12491244
cfg = (Form_pg_ts_config) GETSTRUCT(tup);
12501245

1251-
/* Use template's parser if no other was specified */
1246+
/* Use source's parser if no other was specified */
12521247
if (!OidIsValid(prsOid))
12531248
prsOid = cfg->cfgparser;
12541249

@@ -1283,10 +1278,10 @@ DefineTSConfiguration(List *names, List *parameters)
12831278

12841279
CatalogUpdateIndexes(cfgRel, tup);
12851280

1286-
if (OidIsValid(templateOid) && with_map)
1281+
if (OidIsValid(sourceOid))
12871282
{
12881283
/*
1289-
* Copy token-dicts map from template
1284+
* Copy token-dicts map from source config
12901285
*/
12911286
ScanKeyData skey;
12921287
SysScanDesc scan;
@@ -1297,7 +1292,7 @@ DefineTSConfiguration(List *names, List *parameters)
12971292
ScanKeyInit(&skey,
12981293
Anum_pg_ts_config_map_mapcfg,
12991294
BTEqualStrategyNumber, F_OIDEQ,
1300-
ObjectIdGetDatum(templateOid));
1295+
ObjectIdGetDatum(sourceOid));
13011296

13021297
scan = systable_beginscan(mapRel, TSConfigMapIndexId, true,
13031298
SnapshotNow, 1, &skey);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.