Alvaro Herrera wrote:
> I like Teodor's proposal; I'll see about implementing that.
Attached.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Index: src/bin/scripts/createdb.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/bin/scripts/createdb.c,v
retrieving revision 1.27
diff -c -p -r1.27 createdb.c
*** src/bin/scripts/createdb.c 23 Sep 2008 09:20:38 -0000 1.27
--- src/bin/scripts/createdb.c 10 Nov 2008 15:45:09 -0000
*************** main(int argc, char *argv[])
*** 34,39 ****
--- 34,40 ----
{"encoding", required_argument, NULL, 'E'},
{"lc-collate", required_argument, NULL, 1},
{"lc-ctype", required_argument, NULL, 2},
+ {"locale", required_argument, NULL, 'l'},
{NULL, 0, NULL, 0}
};
*************** main(int argc, char *argv[])
*** 54,59 ****
--- 55,61 ----
char *encoding = NULL;
char *lc_collate = NULL;
char *lc_ctype = NULL;
+ char *locale = NULL;
PQExpBufferData sql;
*************** main(int argc, char *argv[])
*** 65,71 ****
handle_help_version_opts(argc, argv, "createdb", help);
! while ((c = getopt_long(argc, argv, "h:p:U:WeqO:D:T:E:", long_options, &optindex)) != -1)
{
switch (c)
{
--- 67,73 ----
handle_help_version_opts(argc, argv, "createdb", help);
! while ((c = getopt_long(argc, argv, "h:p:U:WeqO:D:T:E:l:", long_options, &optindex)) != -1)
{
switch (c)
{
*************** main(int argc, char *argv[])
*** 105,110 ****
--- 107,115 ----
case 2:
lc_ctype = optarg;
break;
+ case 'l':
+ locale = optarg;
+ break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
exit(1);
*************** main(int argc, char *argv[])
*** 129,134 ****
--- 134,157 ----
exit(1);
}
+ if (locale)
+ {
+ if (lc_ctype)
+ {
+ fprintf(stderr, _("%s: only one of --locale and --lc-ctype can be specified\n"),
+ progname);
+ exit(1);
+ }
+ if (lc_collate)
+ {
+ fprintf(stderr, _("%s: only one of --locale and --lc-collate can be specified\n"),
+ progname);
+ exit(1);
+ }
+ lc_ctype = locale;
+ lc_collate = locale;
+ }
+
if (encoding)
{
if (pg_char_to_encoding(encoding) < 0)
*************** help(const char *progname)
*** 226,231 ****
--- 249,255 ----
printf(_(" -E, --encoding=ENCODING encoding for the database\n"));
printf(_(" --lc-collate=LOCALE LC_COLLATE setting for the database\n"));
printf(_(" --lc-ctype=LOCALE LC_CTYPE setting for the database\n"));
+ printf(_(" -l, --locale=LOCALE locale settings for the database\n"));
printf(_(" -O, --owner=OWNER database user to own the new database\n"));
printf(_(" -T, --template=TEMPLATE template database to copy\n"));
printf(_(" -e, --echo show the commands being sent to the server\n"));
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers