Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitfd33d90

Browse files
committed
Simplify CREATE TEXT SEARCH CONFIGURATION by eliminating the separate
'with map' parameter; as things now stand there's really not much pointin specifying a config-to-copy if you don't copy its map. Also, useCOPY instead of TEMPLATE as the key word for a config-to-copy, so asto avoid confusion with text search templates. Per discussion; thejust-committed reference page for the command already describes itthis way.
1 parent3e3bb36 commitfd33d90

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

‎src/backend/commands/tsearchcmds.c

Lines 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/2101:11:15 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.2 2007/08/2121:24:00 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -1192,10 +1192,9 @@ DefineTSConfiguration(List *names, List *parameters)
11921192
Oidnamespaceoid;
11931193
char*cfgname;
11941194
NameDatacname;
1195-
List*templateName=NIL;
1196-
OidtemplateOid=InvalidOid;
1195+
List*sourceName=NIL;
1196+
OidsourceOid=InvalidOid;
11971197
OidprsOid=InvalidOid;
1198-
boolwith_map= false;
11991198
OidcfgOid;
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-
elseif (pg_strcasecmp(defel->defname,"template")==0)
1221-
templateName=defGetQualifiedName(defel);
1222-
elseif (pg_strcasecmp(defel->defname,"map")==0)
1223-
with_map=defGetBoolean(defel);
1219+
elseif (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_configcfg;
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-
/* Usetemplate's parser if no other was specified */
1246+
/* Usesource'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 fromtemplate
1284+
* Copy token-dicts map fromsource config
12901285
*/
12911286
ScanKeyDataskey;
12921287
SysScanDescscan;
@@ -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)

[8]ページ先頭

©2009-2025 Movatter.jp