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

Commit1eef90d

Browse files
committed
Rename the new CREATE DATABASE options to set collation and ctype into
LC_COLLATE and LC_CTYPE, per discussion on pgsql-hackers.
1 parentf2110a7 commit1eef90d

File tree

10 files changed

+48
-45
lines changed

10 files changed

+48
-45
lines changed

‎doc/src/sgml/charset.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/charset.sgml,v 2.92 2009/03/26 20:55:49 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/charset.sgml,v 2.93 2009/04/06 08:42:52 heikki Exp $ -->
22

33
<chapter id="charset">
44
<title>Localization</>
@@ -749,7 +749,7 @@ createdb -E EUC_KR -T template0 --lc-collate=ko_KR.euckr --lc-ctype=ko_KR.euckr
749749
Another way to accomplish this is to use this SQL command:
750750

751751
<programlisting>
752-
CREATE DATABASE korean WITH ENCODING 'EUC_KR'COLLATE='ko_KR.euckr'CTYPE='ko_KR.euckr' TEMPLATE=template0;
752+
CREATE DATABASE korean WITH ENCODING 'EUC_KR'LC_COLLATE='ko_KR.euckr'LC_CTYPE='ko_KR.euckr' TEMPLATE=template0;
753753
</programlisting>
754754

755755
The encoding for a database is stored in the system catalog

‎doc/src/sgml/keywords.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/keywords.sgml,v 2.23 2009/02/24 10:06:31 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/keywords.sgml,v 2.24 2009/04/06 08:42:52 heikki Exp $ -->
22

33
<appendix id="sql-keywords-appendix">
44
<title><acronym>SQL</acronym> Key Words</title>
@@ -800,7 +800,7 @@
800800
<entry>non-reserved</entry>
801801
</row>
802802
<row>
803-
<entry><token>COLLATE</token></entry>
803+
<entry><token>LC_COLLATE</token></entry>
804804
<entry>reserved</entry>
805805
<entry>reserved</entry>
806806
<entry>reserved</entry>
@@ -1168,7 +1168,7 @@
11681168
<entry></entry>
11691169
</row>
11701170
<row>
1171-
<entry><token>CTYPE</token></entry>
1171+
<entry><token>LC_CTYPE</token></entry>
11721172
<entry>non-reserved</entry>
11731173
<entry></entry>
11741174
<entry></entry>

‎doc/src/sgml/ref/create_database.sgml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.50 2008/11/14 10:22:46 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.51 2009/04/06 08:42:52 heikki Exp $
33
PostgreSQL documentation
44
-->
55

@@ -25,8 +25,8 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
2525
[ [ WITH ] [ OWNER [=] <replaceable class="parameter">dbowner</replaceable> ]
2626
[ TEMPLATE [=] <replaceable class="parameter">template</replaceable> ]
2727
[ ENCODING [=] <replaceable class="parameter">encoding</replaceable> ]
28-
[COLLATE [=] <replaceable class="parameter">collate</replaceable> ]
29-
[CTYPE [=] <replaceable class="parameter">ctype</replaceable> ]
28+
[LC_COLLATE [=] <replaceable class="parameter">lc_collate</replaceable> ]
29+
[LC_CTYPE [=] <replaceable class="parameter">lc_ctype</replaceable> ]
3030
[ TABLESPACE [=] <replaceable class="parameter">tablespace</replaceable> ]
3131
[ CONNECTION LIMIT [=] <replaceable class="parameter">connlimit</replaceable> ] ]
3232
</synopsis>
@@ -207,7 +207,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
207207

208208
<para>
209209
The character set encoding specified for the new database must be
210-
compatible with the chosenCOLLATE andCTYPE settings.
210+
compatible with the chosenLC_COLLATE andLC_CTYPE settings.
211211
If <envar>LC_CTYPE</> is <literal>C</> (or equivalently
212212
<literal>POSIX</>), then all encodings are allowed, but for other
213213
locale settings there is only one encoding that will work properly.
@@ -219,9 +219,9 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
219219
</para>
220220

221221
<para>
222-
The <literal>COLLATE</> and <literal>CTYPE</> settings must match
222+
The <literal>LC_COLLATE</> and <literal>LC_CTYPE</> settings must match
223223
those of the template database, except when template0 is used as
224-
template. This is because <literal>COLLATE</> and <literal>CTYPE</>
224+
template. This is because <literal>LC_COLLATE</> and <literal>LC_CTYPE</>
225225
affects the ordering in indexes, so that any indexes copied from the
226226
template database would be invalid in the new database with different
227227
settings. <literal>template0</literal>, however, is known to not

‎src/backend/commands/dbcommands.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.219 2009/01/30 17:24:47 heikki Exp $
16+
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.220 2009/04/06 08:42:52 heikki Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -169,15 +169,15 @@ createdb(const CreatedbStmt *stmt)
169169
errmsg("conflicting or redundant options")));
170170
dencoding=defel;
171171
}
172-
elseif (strcmp(defel->defname,"collate")==0)
172+
elseif (strcmp(defel->defname,"lc_collate")==0)
173173
{
174174
if (dcollate)
175175
ereport(ERROR,
176176
(errcode(ERRCODE_SYNTAX_ERROR),
177177
errmsg("conflicting or redundant options")));
178178
dcollate=defel;
179179
}
180-
elseif (strcmp(defel->defname,"ctype")==0)
180+
elseif (strcmp(defel->defname,"lc_ctype")==0)
181181
{
182182
if (dctype)
183183
ereport(ERROR,
@@ -362,7 +362,7 @@ createdb(const CreatedbStmt *stmt)
362362
(errmsg("encoding %s does not match locale %s",
363363
pg_encoding_to_char(encoding),
364364
dbctype),
365-
errdetail("The chosenCTYPE setting requires encoding %s.",
365+
errdetail("The chosenLC_CTYPE setting requires encoding %s.",
366366
pg_encoding_to_char(ctype_encoding))));
367367

368368
if (!(collate_encoding==encoding||
@@ -375,7 +375,7 @@ createdb(const CreatedbStmt *stmt)
375375
(errmsg("encoding %s does not match locale %s",
376376
pg_encoding_to_char(encoding),
377377
dbcollate),
378-
errdetail("The chosenCOLLATE setting requires encoding %s.",
378+
errdetail("The chosenLC_COLLATE setting requires encoding %s.",
379379
pg_encoding_to_char(collate_encoding))));
380380

381381
/*
@@ -394,8 +394,8 @@ createdb(const CreatedbStmt *stmt)
394394

395395
if (strcmp(dbctype,src_ctype))
396396
ereport(ERROR,
397-
(errmsg("newctype is incompatible withthe ctype of the template database (%s)",src_ctype),
398-
errhint("Use the samectype as in the template database, or use template0 as template")));
397+
(errmsg("newLC_CTYPE is incompatible withLC_CTYPE of the template database (%s)",src_ctype),
398+
errhint("Use the sameLC_CTYPE as in the template database, or use template0 as template")));
399399
}
400400

401401
/* Resolve default tablespace for new database */

‎src/backend/parser/gram.y

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.661 2009/04/04 21:12:31 tgl Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.662 2009/04/06 08:42:52 heikki Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -437,7 +437,7 @@ static TypeName *TableFuncTypeName(List *columns);
437437
CLUSTER COALESCE COLLATE COLUMN COMMENT COMMIT
438438
COMMITTED CONCURRENTLY CONFIGURATION CONNECTION CONSTRAINT CONSTRAINTS
439439
CONTENT_P CONTINUE_P CONVERSION_P COPY COST CREATE CREATEDB
440-
CREATEROLE CREATEUSER CROSS CSVCTYPECURRENT_P
440+
CREATEROLE CREATEUSER CROSS CSV CURRENT_P
441441
CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA
442442
CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
443443

@@ -464,9 +464,9 @@ static TypeName *TableFuncTypeName(List *columns);
464464

465465
KEY
466466

467-
LANCOMPILER LANGUAGE LARGE_P LAST_PLEADING LEAST LEFT LEVEL
468-
LIKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION
469-
LOCK_P LOGIN_P
467+
LANCOMPILER LANGUAGE LARGE_P LAST_PLC_COLLATE_P LC_CTYPE_P LEADING
468+
LEAST LEFT LEVELLIKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP
469+
LOCATIONLOCK_P LOGIN_P
470470

471471
MAPPING MATCH MAXVALUE MINUTE_P MINVALUE MODE MONTH_P MOVE
472472

@@ -6011,21 +6011,21 @@ createdb_opt_item:
60116011
{
60126012
$$ = makeDefElem("encoding",NULL);
60136013
}
6014-
|COLLATE opt_equal Sconst
6014+
|LC_COLLATE_P opt_equal Sconst
60156015
{
6016-
$$ = makeDefElem("collate", (Node *)makeString($3));
6016+
$$ = makeDefElem("lc_collate", (Node *)makeString($3));
60176017
}
6018-
|COLLATE opt_equal DEFAULT
6018+
|LC_COLLATE_P opt_equal DEFAULT
60196019
{
6020-
$$ = makeDefElem("collate",NULL);
6020+
$$ = makeDefElem("lc_collate",NULL);
60216021
}
6022-
|CTYPE opt_equal Sconst
6022+
|LC_CTYPE_P opt_equal Sconst
60236023
{
6024-
$$ = makeDefElem("ctype", (Node *)makeString($3));
6024+
$$ = makeDefElem("lc_ctype", (Node *)makeString($3));
60256025
}
6026-
|CTYPE opt_equal DEFAULT
6026+
|LC_CTYPE_P opt_equal DEFAULT
60276027
{
6028-
$$ = makeDefElem("ctype",NULL);
6028+
$$ = makeDefElem("lc_ctype",NULL);
60296029
}
60306030
| CONNECTION LIMIT opt_equal SignedIconst
60316031
{
@@ -10169,7 +10169,6 @@ unreserved_keyword:
1016910169
| CREATEROLE
1017010170
| CREATEUSER
1017110171
| CSV
10172-
| CTYPE
1017310172
| CURRENT_P
1017410173
| CURSOR
1017510174
| CYCLE
@@ -10236,6 +10235,8 @@ unreserved_keyword:
1023610235
| LANGUAGE
1023710236
| LARGE_P
1023810237
| LAST_P
10238+
| LC_COLLATE_P
10239+
| LC_CTYPE_P
1023910240
| LEVEL
1024010241
| LISTEN
1024110242
| LOAD

‎src/bin/pg_dump/pg_dump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.533 2009/04/05 04:19:58 tgl Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.534 2009/04/06 08:42:53 heikki Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -1716,12 +1716,12 @@ dumpDatabase(Archive *AH)
17161716
}
17171717
if (strlen(collate)>0)
17181718
{
1719-
appendPQExpBuffer(creaQry,"COLLATE = ");
1719+
appendPQExpBuffer(creaQry,"LC_COLLATE = ");
17201720
appendStringLiteralAH(creaQry,collate,AH);
17211721
}
17221722
if (strlen(ctype)>0)
17231723
{
1724-
appendPQExpBuffer(creaQry,"CTYPE = ");
1724+
appendPQExpBuffer(creaQry,"LC_CTYPE = ");
17251725
appendStringLiteralAH(creaQry,ctype,AH);
17261726
}
17271727
if (strlen(tablespace)>0&&strcmp(tablespace,"pg_default")!=0)

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.121 2009/04/05 04:19:58 tgl Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.122 2009/04/06 08:42:53 heikki Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -1048,13 +1048,13 @@ dumpCreateDB(PGconn *conn)
10481048

10491049
if (strlen(dbcollate)!=0)
10501050
{
1051-
appendPQExpBuffer(buf,"COLLATE = ");
1051+
appendPQExpBuffer(buf,"LC_COLLATE = ");
10521052
appendStringLiteralConn(buf,dbcollate,conn);
10531053
}
10541054

10551055
if (strlen(dbctype)!=0)
10561056
{
1057-
appendPQExpBuffer(buf,"CTYPE = ");
1057+
appendPQExpBuffer(buf,"LC_CTYPE = ");
10581058
appendStringLiteralConn(buf,dbctype,conn);
10591059
}
10601060

‎src/bin/scripts/createdb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
8-
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.33 2009/02/26 16:20:55 petere Exp $
8+
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.34 2009/04/06 08:42:53 heikki Exp $
99
*
1010
*-------------------------------------------------------------------------
1111
*/
@@ -186,9 +186,9 @@ main(int argc, char *argv[])
186186
if (template)
187187
appendPQExpBuffer(&sql," TEMPLATE %s",fmtId(template));
188188
if (lc_collate)
189-
appendPQExpBuffer(&sql,"COLLATE '%s'",lc_collate);
189+
appendPQExpBuffer(&sql,"LC_COLLATE '%s'",lc_collate);
190190
if (lc_ctype)
191-
appendPQExpBuffer(&sql,"CTYPE '%s'",lc_ctype);
191+
appendPQExpBuffer(&sql,"LC_CTYPE '%s'",lc_ctype);
192192

193193
appendPQExpBuffer(&sql,";\n");
194194

‎src/include/parser/kwlist.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1994, Regents of the University of California
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/include/parser/kwlist.h,v 1.1 2009/03/07 00:13:58 alvherre Exp $
14+
* $PostgreSQL: pgsql/src/include/parser/kwlist.h,v 1.2 2009/04/06 08:42:53 heikki Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -98,7 +98,6 @@ PG_KEYWORD("createrole", CREATEROLE, UNRESERVED_KEYWORD)
9898
PG_KEYWORD("createuser",CREATEUSER,UNRESERVED_KEYWORD)
9999
PG_KEYWORD("cross",CROSS,TYPE_FUNC_NAME_KEYWORD)
100100
PG_KEYWORD("csv",CSV,UNRESERVED_KEYWORD)
101-
PG_KEYWORD("ctype",CTYPE,UNRESERVED_KEYWORD)
102101
PG_KEYWORD("current",CURRENT_P,UNRESERVED_KEYWORD)
103102
PG_KEYWORD("current_catalog",CURRENT_CATALOG,RESERVED_KEYWORD)
104103
PG_KEYWORD("current_date",CURRENT_DATE,RESERVED_KEYWORD)
@@ -209,6 +208,8 @@ PG_KEYWORD("lancompiler", LANCOMPILER, UNRESERVED_KEYWORD)
209208
PG_KEYWORD("language",LANGUAGE,UNRESERVED_KEYWORD)
210209
PG_KEYWORD("large",LARGE_P,UNRESERVED_KEYWORD)
211210
PG_KEYWORD("last",LAST_P,UNRESERVED_KEYWORD)
211+
PG_KEYWORD("lc_collate",LC_COLLATE_P,UNRESERVED_KEYWORD)
212+
PG_KEYWORD("lc_ctype",LC_CTYPE_P,UNRESERVED_KEYWORD)
212213
PG_KEYWORD("leading",LEADING,RESERVED_KEYWORD)
213214
PG_KEYWORD("least",LEAST,COL_NAME_KEYWORD)
214215
PG_KEYWORD("left",LEFT,TYPE_FUNC_NAME_KEYWORD)

‎src/interfaces/ecpg/preproc/ecpg.trailer

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.6 2009/01/30 12:53:43 petere Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.7 2009/04/06 08:42:53 heikki Exp $ */
22

33
statements: /*EMPTY*/
44
| statements statement
@@ -1547,7 +1547,6 @@ ECPGunreserved_con: ABORT_P{ $$ = make_str("abort"); }
15471547
| CREATEROLE{ $$ = make_str("createrole"); }
15481548
| CREATEUSER{ $$ = make_str("createuser"); }
15491549
| CSV{ $$ = make_str("csv"); }
1550-
| CTYPE{ $$ = make_str("ctype"); }
15511550
| CURSOR{ $$ = make_str("cursor"); }
15521551
| CYCLE{ $$ = make_str("cycle"); }
15531552
| DATA_P{ $$ = make_str("data"); }
@@ -1610,6 +1609,8 @@ ECPGunreserved_con: ABORT_P{ $$ = make_str("abort"); }
16101609
| LANGUAGE{ $$ = make_str("language"); }
16111610
| LARGE_P{ $$ = make_str("large"); }
16121611
| LAST_P{ $$ = make_str("last"); }
1612+
| LC_COLLATE_P{ $$ = make_str("lc_collate"); }
1613+
| LC_CTYPE_P{ $$ = make_str("lc_ctype"); }
16131614
| LEVEL{ $$ = make_str("level"); }
16141615
| LISTEN{ $$ = make_str("listen"); }
16151616
| LOAD{ $$ = make_str("load"); }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp