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

Commit48c16e1

Browse files
committed
Make initdb's selection of default text search configuration depend
only on the 'language' part of the locale name, ignoring the country code.We may need to be smarter later when there are more built-in configurations,but for now this is good enough and avoids having to bloat the table.
1 parentdd7444c commit48c16e1

File tree

1 file changed

+34
-36
lines changed

1 file changed

+34
-36
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.148 2007/10/24 20:11:00 alvherre Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.149 2007/10/25 20:22:53 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -719,7 +719,7 @@ get_encoding_id(char *encoding_name)
719719

720720
/*
721721
* Support for determining the best default text search configuration.
722-
* We key this offLC_CTYPE, after stripping its encoding indicator if any.
722+
* We key this offthe first part of LC_CTYPE (ie, the language name).
723723
*/
724724
structtsearch_config_match
725725
{
@@ -729,39 +729,37 @@ struct tsearch_config_match
729729

730730
staticconststructtsearch_config_matchtsearch_config_languages[]=
731731
{
732-
{"danish","da_DK"},
733-
{"danish","Danish_Denmark"},
734-
{"dutch","nl_NL"},
735-
{"dutch","Dutch_Netherlands"},
732+
{"danish","da"},
733+
{"danish","Danish"},
734+
{"dutch","nl"},
735+
{"dutch","Dutch"},
736736
{"english","C"},
737737
{"english","POSIX"},
738-
{"english","en_US"},
739-
{"english","English_America"},
740-
{"english","en_UK"},
741-
{"english","English_Britain"},
742-
{"finnish","fi_FI"},
743-
{"finnish","Finnish_Finland"},
744-
{"french","fr_FR"},
745-
{"french","French_France"},
746-
{"german","de_DE"},
747-
{"german","German_Germany"},
748-
{"hungarian","hu_HU"},
749-
{"hungarian","Hungarian_Hungary"},
750-
{"italian","it_IT"},
751-
{"italian","Italian_Italy"},
752-
{"norwegian","no_NO"},
753-
{"norwegian","Norwegian_Norway"},
754-
{"portuguese","pt_PT"},
755-
{"portuguese","Portuguese_Portugal"},
756-
{"romanian","ro_RO"},
757-
{"russian","ru_RU"},
758-
{"russian","Russian_Russia"},
759-
{"spanish","es_ES"},
760-
{"spanish","Spanish_Spain"},
761-
{"swedish","sv_SE"},
762-
{"swedish","Swedish_Sweden"},
763-
{"turkish","tr_TR"},
764-
{"turkish","Turkish_Turkey"},
738+
{"english","en"},
739+
{"english","English"},
740+
{"finnish","fi"},
741+
{"finnish","Finnish"},
742+
{"french","fr"},
743+
{"french","French"},
744+
{"german","de"},
745+
{"german","German"},
746+
{"hungarian","hu"},
747+
{"hungarian","Hungarian"},
748+
{"italian","it"},
749+
{"italian","Italian"},
750+
{"norwegian","no"},
751+
{"norwegian","Norwegian"},
752+
{"portuguese","pt"},
753+
{"portuguese","Portuguese"},
754+
{"romanian","ro"},
755+
{"russian","ru"},
756+
{"russian","Russian"},
757+
{"spanish","es"},
758+
{"spanish","Spanish"},
759+
{"swedish","sv"},
760+
{"swedish","Swedish"},
761+
{"turkish","tr"},
762+
{"turkish","Turkish"},
765763
{NULL,NULL}/* end marker */
766764
};
767765

@@ -777,15 +775,15 @@ find_matching_ts_config(const char *lc_type)
777775
*ptr;
778776

779777
/*
780-
* Convert lc_ctype to a language name by stripping".utf8", "@euro", or
781-
*what-have-you
778+
* Convert lc_ctype to a language name by strippingeverything after
779+
*an underscore. Just for paranoia, we also stop at '.' or '@'.
782780
*/
783781
if (lc_type==NULL)
784782
langname=xstrdup("");
785783
else
786784
{
787785
ptr=langname=xstrdup(lc_type);
788-
while (*ptr&&*ptr!='.'&&*ptr!='@')
786+
while (*ptr&&*ptr!='_'&&*ptr!='.'&&*ptr!='@')
789787
ptr++;
790788
*ptr='\0';
791789
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp