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

Commit2116826

Browse files
committed
Simplify implementation of ts_debug() function --- use a join instead
of redundant sub-selects. initdb not forced, since this is just acosmetic change, but the new code won't show up till you do one.
1 parente4a52ec commit2116826

File tree

1 file changed

+18
-30
lines changed

1 file changed

+18
-30
lines changed

‎src/backend/catalog/system_views.sql

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 1996-2007, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.40 2007/08/21 01:11:13 tgl Exp $
6+
* $PostgreSQL: pgsql/src/backend/catalog/system_views.sql,v 1.41 2007/08/25 17:47:44 tgl Exp $
77
*/
88

99
CREATEVIEWpg_rolesAS
@@ -394,37 +394,19 @@ CREATE TYPE ts_debug AS (
394394
"Lexized token"text
395395
);
396396

397-
COMMENT ON TYPE ts_debug IS'returnedtype from ts_debug() function';
397+
COMMENT ON TYPE ts_debug IS'type returned from ts_debug() function';
398398

399399
CREATEFUNCTIONts_debug(regconfig,text)
400400
RETURNS SETOF ts_debugAS
401401
$$
402402
SELECT
403-
(
404-
SELECT
405-
tt.alias
406-
FROM
407-
pg_catalog.ts_token_type(
408-
(SELECT cfgparserFROMpg_catalog.pg_ts_configWHEREoid= $1 )
409-
)AS tt
410-
WHERE
411-
tt.tokid=parse.tokid
412-
)AS"Alias",
413-
(
414-
SELECT
415-
tt.description
416-
FROM
417-
pg_catalog.ts_token_type(
418-
(SELECT cfgparserFROMpg_catalog.pg_ts_configWHEREoid= $1 )
419-
)AS tt
420-
WHERE
421-
tt.tokid=parse.tokid
422-
)AS"Description",
403+
tt.aliasAS"Alias",
404+
tt.descriptionAS"Description",
423405
parse.tokenAS"Token",
424406
ARRAY (SELECTm.mapdict::pg_catalog.regdictionary
425407
FROMpg_catalog.pg_ts_config_mapAS m
426408
WHEREm.mapcfg= $1ANDm.maptokentype=parse.tokid
427-
ORDER BYm.mapcfg,m.maptokentype,m.mapseqno )
409+
ORDER BYm.mapseqno )
428410
AS"Dictionaries",
429411
(
430412
SELECT
@@ -433,23 +415,29 @@ SELECT
433415
(SELECT mapdict,pg_catalog.ts_lexize(mapdict,parse.token)AS lex
434416
FROMpg_catalog.pg_ts_config_mapAS m
435417
WHEREm.mapcfg= $1ANDm.maptokentype=parse.tokid
436-
ORDER BYm.mapcfg,m.maptokentype,m.mapseqno ) dl
418+
ORDER BYm.mapseqno ) dl
437419
WHEREdl.lexIS NOT NULL
438420
LIMIT1
439421
)AS"Lexized token"
440422
FROMpg_catalog.ts_parse(
441423
(SELECT cfgparserFROMpg_catalog.pg_ts_configWHEREoid= $1 ), $2
442-
)AS parse;
424+
)AS parse,
425+
pg_catalog.ts_token_type(
426+
(SELECT cfgparserFROMpg_catalog.pg_ts_configWHEREoid= $1 )
427+
)AS tt
428+
WHEREtt.tokid=parse.tokid
443429
$$
444-
LANGUAGE SQLRETURNSNULLONNULL INPUT;
430+
LANGUAGE SQLSTRICT STABLE;
445431

446-
COMMENT ON FUNCTION ts_debug(regconfig,text) IS'debug function for text search configuration';
432+
COMMENT ON FUNCTION ts_debug(regconfig,text) IS
433+
'debug function for text search configuration';
447434

448435
CREATEFUNCTIONts_debug(text)
449436
RETURNS SETOF ts_debugAS
450437
$$
451-
SELECT*FROMpg_catalog.ts_debug(pg_catalog.get_current_ts_config(), $1);
438+
SELECT*FROMpg_catalog.ts_debug(pg_catalog.get_current_ts_config(), $1);
452439
$$
453-
LANGUAGE SQLRETURNSNULLONNULL INPUT;
440+
LANGUAGE SQLSTRICT STABLE;
454441

455-
COMMENT ON FUNCTION ts_debug(text) IS'debug function for current text search configuration';
442+
COMMENT ON FUNCTION ts_debug(text) IS
443+
'debug function for current text search configuration';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp