Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
1eef90d0
Commit
1eef90d0
authored
Apr 06, 2009
by
Heikki Linnakangas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename the new CREATE DATABASE options to set collation and ctype into
LC_COLLATE and LC_CTYPE, per discussion on pgsql-hackers.
parent
f2110a75
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
48 additions
and
45 deletions
+48
-45
doc/src/sgml/charset.sgml
doc/src/sgml/charset.sgml
+2
-2
doc/src/sgml/keywords.sgml
doc/src/sgml/keywords.sgml
+3
-3
doc/src/sgml/ref/create_database.sgml
doc/src/sgml/ref/create_database.sgml
+6
-6
src/backend/commands/dbcommands.c
src/backend/commands/dbcommands.c
+7
-7
src/backend/parser/gram.y
src/backend/parser/gram.y
+15
-14
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.c
+3
-3
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_dumpall.c
+3
-3
src/bin/scripts/createdb.c
src/bin/scripts/createdb.c
+3
-3
src/include/parser/kwlist.h
src/include/parser/kwlist.h
+3
-2
src/interfaces/ecpg/preproc/ecpg.trailer
src/interfaces/ecpg/preproc/ecpg.trailer
+3
-2
No files found.
doc/src/sgml/charset.sgml
View file @
1eef90d0
<!-- $PostgreSQL: pgsql/doc/src/sgml/charset.sgml,v 2.9
2 2009/03/26 20:55:49 tgl
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/charset.sgml,v 2.9
3 2009/04/06 08:42:52 heikki
Exp $ -->
<chapter id="charset">
<title>Localization</>
...
...
@@ -749,7 +749,7 @@ createdb -E EUC_KR -T template0 --lc-collate=ko_KR.euckr --lc-ctype=ko_KR.euckr
Another way to accomplish this is to use this SQL command:
<programlisting>
CREATE DATABASE korean WITH ENCODING 'EUC_KR'
COLLATE='ko_KR.euckr'
CTYPE='ko_KR.euckr' TEMPLATE=template0;
CREATE DATABASE korean WITH ENCODING 'EUC_KR'
LC_COLLATE='ko_KR.euckr' LC_
CTYPE='ko_KR.euckr' TEMPLATE=template0;
</programlisting>
The encoding for a database is stored in the system catalog
...
...
doc/src/sgml/keywords.sgml
View file @
1eef90d0
<!-- $PostgreSQL: pgsql/doc/src/sgml/keywords.sgml,v 2.2
3 2009/02/24 10:06:31 petere
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/keywords.sgml,v 2.2
4 2009/04/06 08:42:52 heikki
Exp $ -->
<appendix id="sql-keywords-appendix">
<title><acronym>SQL</acronym> Key Words</title>
...
...
@@ -800,7 +800,7 @@
<entry>non-reserved</entry>
</row>
<row>
<entry><token>COLLATE</token></entry>
<entry><token>
LC_
COLLATE</token></entry>
<entry>reserved</entry>
<entry>reserved</entry>
<entry>reserved</entry>
...
...
@@ -1168,7 +1168,7 @@
<entry></entry>
</row>
<row>
<entry><token>CTYPE</token></entry>
<entry><token>
LC_
CTYPE</token></entry>
<entry>non-reserved</entry>
<entry></entry>
<entry></entry>
...
...
doc/src/sgml/ref/create_database.sgml
View file @
1eef90d0
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.5
0 2008/11/14 10:22:46 petere
Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/create_database.sgml,v 1.5
1 2009/04/06 08:42:52 heikki
Exp $
PostgreSQL documentation
-->
...
...
@@ -25,8 +25,8 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
[ [ WITH ] [ OWNER [=] <replaceable class="parameter">dbowner</replaceable> ]
[ TEMPLATE [=] <replaceable class="parameter">template</replaceable> ]
[ ENCODING [=] <replaceable class="parameter">encoding</replaceable> ]
[
COLLATE [=] <replaceable class="parameter">
collate</replaceable> ]
[
CTYPE [=] <replaceable class="parameter">
ctype</replaceable> ]
[
LC_COLLATE [=] <replaceable class="parameter">lc_
collate</replaceable> ]
[
LC_CTYPE [=] <replaceable class="parameter">lc_
ctype</replaceable> ]
[ TABLESPACE [=] <replaceable class="parameter">tablespace</replaceable> ]
[ CONNECTION LIMIT [=] <replaceable class="parameter">connlimit</replaceable> ] ]
</synopsis>
...
...
@@ -207,7 +207,7 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
<para>
The character set encoding specified for the new database must be
compatible with the chosen
COLLATE and
CTYPE settings.
compatible with the chosen
LC_COLLATE and LC_
CTYPE settings.
If <envar>LC_CTYPE</> is <literal>C</> (or equivalently
<literal>POSIX</>), then all encodings are allowed, but for other
locale settings there is only one encoding that will work properly.
...
...
@@ -219,9 +219,9 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
</para>
<para>
The <literal>
COLLATE</> and <literal>
CTYPE</> settings must match
The <literal>
LC_COLLATE</> and <literal>LC_
CTYPE</> settings must match
those of the template database, except when template0 is used as
template. This is because <literal>
COLLATE</> and <literal>
CTYPE</>
template. This is because <literal>
LC_COLLATE</> and <literal>LC_
CTYPE</>
affects the ordering in indexes, so that any indexes copied from the
template database would be invalid in the new database with different
settings. <literal>template0</literal>, however, is known to not
...
...
src/backend/commands/dbcommands.c
View file @
1eef90d0
...
...
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.2
19 2009/01/30 17:24:47
heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.2
20 2009/04/06 08:42:52
heikki Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -169,7 +169,7 @@ createdb(const CreatedbStmt *stmt)
errmsg
(
"conflicting or redundant options"
)));
dencoding
=
defel
;
}
else
if
(
strcmp
(
defel
->
defname
,
"collate"
)
==
0
)
else
if
(
strcmp
(
defel
->
defname
,
"
lc_
collate"
)
==
0
)
{
if
(
dcollate
)
ereport
(
ERROR
,
...
...
@@ -177,7 +177,7 @@ createdb(const CreatedbStmt *stmt)
errmsg
(
"conflicting or redundant options"
)));
dcollate
=
defel
;
}
else
if
(
strcmp
(
defel
->
defname
,
"ctype"
)
==
0
)
else
if
(
strcmp
(
defel
->
defname
,
"
lc_
ctype"
)
==
0
)
{
if
(
dctype
)
ereport
(
ERROR
,
...
...
@@ -362,7 +362,7 @@ createdb(const CreatedbStmt *stmt)
(
errmsg
(
"encoding %s does not match locale %s"
,
pg_encoding_to_char
(
encoding
),
dbctype
),
errdetail
(
"The chosen CTYPE setting requires encoding %s."
,
errdetail
(
"The chosen
LC_
CTYPE setting requires encoding %s."
,
pg_encoding_to_char
(
ctype_encoding
))));
if
(
!
(
collate_encoding
==
encoding
||
...
...
@@ -375,7 +375,7 @@ createdb(const CreatedbStmt *stmt)
(
errmsg
(
"encoding %s does not match locale %s"
,
pg_encoding_to_char
(
encoding
),
dbcollate
),
errdetail
(
"The chosen COLLATE setting requires encoding %s."
,
errdetail
(
"The chosen
LC_
COLLATE setting requires encoding %s."
,
pg_encoding_to_char
(
collate_encoding
))));
/*
...
...
@@ -394,8 +394,8 @@ createdb(const CreatedbStmt *stmt)
if
(
strcmp
(
dbctype
,
src_ctype
))
ereport
(
ERROR
,
(
errmsg
(
"new
ctype is incompatible with the ctype
of the template database (%s)"
,
src_ctype
),
errhint
(
"Use the same
ctype
as in the template database, or use template0 as template"
)));
(
errmsg
(
"new
LC_CTYPE is incompatible with LC_CTYPE
of the template database (%s)"
,
src_ctype
),
errhint
(
"Use the same
LC_CTYPE
as in the template database, or use template0 as template"
)));
}
/* Resolve default tablespace for new database */
...
...
src/backend/parser/gram.y
View file @
1eef90d0
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.66
1 2009/04/04 21:12:31 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.66
2 2009/04/06 08:42:52 heikki
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -437,7 +437,7 @@ static TypeName *TableFuncTypeName(List *columns);
CLUSTER COALESCE COLLATE COLUMN COMMENT COMMIT
COMMITTED CONCURRENTLY CONFIGURATION CONNECTION CONSTRAINT CONSTRAINTS
CONTENT_P CONTINUE_P CONVERSION_P COPY COST CREATE CREATEDB
CREATEROLE CREATEUSER CROSS CSV C
TYPE C
URRENT_P
CREATEROLE CREATEUSER CROSS CSV CURRENT_P
CURRENT_CATALOG CURRENT_DATE CURRENT_ROLE CURRENT_SCHEMA
CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
...
...
@@ -464,9 +464,9 @@ static TypeName *TableFuncTypeName(List *columns);
KEY
LANCOMPILER LANGUAGE LARGE_P LAST_P L
EADING LEAST LEFT LEVEL
L
IKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION
LOCK_P LOGIN_P
LANCOMPILER LANGUAGE LARGE_P LAST_P L
C_COLLATE_P LC_CTYPE_P LEADING
L
EAST LEFT LEVEL LIKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP
LOC
ATION LOC
K_P LOGIN_P
MAPPING MATCH MAXVALUE MINUTE_P MINVALUE MODE MONTH_P MOVE
...
...
@@ -6011,21 +6011,21 @@ createdb_opt_item:
{
$$ = makeDefElem("encoding", NULL);
}
|
COLLATE
opt_equal Sconst
|
LC_COLLATE_P
opt_equal Sconst
{
$$ = makeDefElem("collate", (Node *)makeString($3));
$$ = makeDefElem("
lc_
collate", (Node *)makeString($3));
}
|
COLLATE
opt_equal DEFAULT
|
LC_COLLATE_P
opt_equal DEFAULT
{
$$ = makeDefElem("collate", NULL);
$$ = makeDefElem("
lc_
collate", NULL);
}
|
CTYPE
opt_equal Sconst
|
LC_CTYPE_P
opt_equal Sconst
{
$$ = makeDefElem("ctype", (Node *)makeString($3));
$$ = makeDefElem("
lc_
ctype", (Node *)makeString($3));
}
|
CTYPE
opt_equal DEFAULT
|
LC_CTYPE_P
opt_equal DEFAULT
{
$$ = makeDefElem("ctype", NULL);
$$ = makeDefElem("
lc_
ctype", NULL);
}
| CONNECTION LIMIT opt_equal SignedIconst
{
...
...
@@ -10169,7 +10169,6 @@ unreserved_keyword:
| CREATEROLE
| CREATEUSER
| CSV
| CTYPE
| CURRENT_P
| CURSOR
| CYCLE
...
...
@@ -10236,6 +10235,8 @@ unreserved_keyword:
| LANGUAGE
| LARGE_P
| LAST_P
| LC_COLLATE_P
| LC_CTYPE_P
| LEVEL
| LISTEN
| LOAD
...
...
src/bin/pg_dump/pg_dump.c
View file @
1eef90d0
...
...
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.53
3 2009/04/05 04:19:58 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.53
4 2009/04/06 08:42:53 heikki
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1716,12 +1716,12 @@ dumpDatabase(Archive *AH)
}
if
(
strlen
(
collate
)
>
0
)
{
appendPQExpBuffer
(
creaQry
,
" COLLATE = "
);
appendPQExpBuffer
(
creaQry
,
"
LC_
COLLATE = "
);
appendStringLiteralAH
(
creaQry
,
collate
,
AH
);
}
if
(
strlen
(
ctype
)
>
0
)
{
appendPQExpBuffer
(
creaQry
,
" CTYPE = "
);
appendPQExpBuffer
(
creaQry
,
"
LC_
CTYPE = "
);
appendStringLiteralAH
(
creaQry
,
ctype
,
AH
);
}
if
(
strlen
(
tablespace
)
>
0
&&
strcmp
(
tablespace
,
"pg_default"
)
!=
0
)
...
...
src/bin/pg_dump/pg_dumpall.c
View file @
1eef90d0
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.12
1 2009/04/05 04:19:58 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.12
2 2009/04/06 08:42:53 heikki
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1048,13 +1048,13 @@ dumpCreateDB(PGconn *conn)
if
(
strlen
(
dbcollate
)
!=
0
)
{
appendPQExpBuffer
(
buf
,
" COLLATE = "
);
appendPQExpBuffer
(
buf
,
"
LC_
COLLATE = "
);
appendStringLiteralConn
(
buf
,
dbcollate
,
conn
);
}
if
(
strlen
(
dbctype
)
!=
0
)
{
appendPQExpBuffer
(
buf
,
" CTYPE = "
);
appendPQExpBuffer
(
buf
,
"
LC_
CTYPE = "
);
appendStringLiteralConn
(
buf
,
dbctype
,
conn
);
}
...
...
src/bin/scripts/createdb.c
View file @
1eef90d0
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.3
3 2009/02/26 16:20:55 petere
Exp $
* $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.3
4 2009/04/06 08:42:53 heikki
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -186,9 +186,9 @@ main(int argc, char *argv[])
if
(
template
)
appendPQExpBuffer
(
&
sql
,
" TEMPLATE %s"
,
fmtId
(
template
));
if
(
lc_collate
)
appendPQExpBuffer
(
&
sql
,
" COLLATE '%s'"
,
lc_collate
);
appendPQExpBuffer
(
&
sql
,
"
LC_
COLLATE '%s'"
,
lc_collate
);
if
(
lc_ctype
)
appendPQExpBuffer
(
&
sql
,
" CTYPE '%s'"
,
lc_ctype
);
appendPQExpBuffer
(
&
sql
,
"
LC_
CTYPE '%s'"
,
lc_ctype
);
appendPQExpBuffer
(
&
sql
,
";
\n
"
);
...
...
src/include/parser/kwlist.h
View file @
1eef90d0
...
...
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/include/parser/kwlist.h,v 1.
1 2009/03/07 00:13:58 alvherre
Exp $
* $PostgreSQL: pgsql/src/include/parser/kwlist.h,v 1.
2 2009/04/06 08:42:53 heikki
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -98,7 +98,6 @@ PG_KEYWORD("createrole", CREATEROLE, UNRESERVED_KEYWORD)
PG_KEYWORD
(
"createuser"
,
CREATEUSER
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"cross"
,
CROSS
,
TYPE_FUNC_NAME_KEYWORD
)
PG_KEYWORD
(
"csv"
,
CSV
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"ctype"
,
CTYPE
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"current"
,
CURRENT_P
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"current_catalog"
,
CURRENT_CATALOG
,
RESERVED_KEYWORD
)
PG_KEYWORD
(
"current_date"
,
CURRENT_DATE
,
RESERVED_KEYWORD
)
...
...
@@ -209,6 +208,8 @@ PG_KEYWORD("lancompiler", LANCOMPILER, UNRESERVED_KEYWORD)
PG_KEYWORD
(
"language"
,
LANGUAGE
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"large"
,
LARGE_P
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"last"
,
LAST_P
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"lc_collate"
,
LC_COLLATE_P
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"lc_ctype"
,
LC_CTYPE_P
,
UNRESERVED_KEYWORD
)
PG_KEYWORD
(
"leading"
,
LEADING
,
RESERVED_KEYWORD
)
PG_KEYWORD
(
"least"
,
LEAST
,
COL_NAME_KEYWORD
)
PG_KEYWORD
(
"left"
,
LEFT
,
TYPE_FUNC_NAME_KEYWORD
)
...
...
src/interfaces/ecpg/preproc/ecpg.trailer
View file @
1eef90d0
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.
6 2009/01/30 12:53:43 petere
Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.
7 2009/04/06 08:42:53 heikki
Exp $ */
statements: /*EMPTY*/
| statements statement
...
...
@@ -1547,7 +1547,6 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| CREATEROLE { $$ = make_str("createrole"); }
| CREATEUSER { $$ = make_str("createuser"); }
| CSV { $$ = make_str("csv"); }
| CTYPE { $$ = make_str("ctype"); }
| CURSOR { $$ = make_str("cursor"); }
| CYCLE { $$ = make_str("cycle"); }
| DATA_P { $$ = make_str("data"); }
...
...
@@ -1610,6 +1609,8 @@ ECPGunreserved_con: ABORT_P { $$ = make_str("abort"); }
| LANGUAGE { $$ = make_str("language"); }
| LARGE_P { $$ = make_str("large"); }
| LAST_P { $$ = make_str("last"); }
| LC_COLLATE_P { $$ = make_str("lc_collate"); }
| LC_CTYPE_P { $$ = make_str("lc_ctype"); }
| LEVEL { $$ = make_str("level"); }
| LISTEN { $$ = make_str("listen"); }
| LOAD { $$ = make_str("load"); }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment