diff options
| author | Tatsuo Ishii | 2002-07-18 02:02:30 +0000 |
|---|---|---|
| committer | Tatsuo Ishii | 2002-07-18 02:02:30 +0000 |
| commit | eb335a034b571516cfbb2309a46177b435c9f913 (patch) | |
| tree | d53443be42b53e109cf3ca8a4fd3d3a0bc091a7e /src/bin | |
| parent | df432df9face8d69c9fd5ec4e77d6636ead2e00f (diff) | |
I have committed many support files for CREATE CONVERSION. Default
conversion procs and conversions are added in initdb. Currently
supported conversions are:
UTF-8(UNICODE) <--> SQL_ASCII, ISO-8859-1 to 16, EUC_JP, EUC_KR,
EUC_CN, EUC_TW, SJIS, BIG5, GBK, GB18030, UHC,
JOHAB, TCVN
EUC_JP <--> SJIS
EUC_TW <--> BIG5
MULE_INTERNAL <--> EUC_JP, SJIS, EUC_TW, BIG5
Note that initial contents of pg_conversion system catalog are created
in the initdb process. So doing initdb required is ideal, it's
possible to add them to your databases by hand, however. To accomplish
this:
psql -f your_postgresql_install_path/share/conversion_create.sql your_database
So I did not bump up the version in cataversion.h.
TODO:
Add more conversion procs
Add [CASCADE|RESTRICT] to DROP CONVERSION
Add tuples to pg_depend
Add regression tests
Write docs
Add SQL99 CONVERT command?
--
Tatsuo Ishii
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/initdb/initdb.sh | 7 | ||||
| -rw-r--r-- | src/bin/psql/command.c | 15 |
2 files changed, 8 insertions, 14 deletions
diff --git a/src/bin/initdb/initdb.sh b/src/bin/initdb/initdb.sh index 9948bcd7fe4..a88eed353b1 100644 --- a/src/bin/initdb/initdb.sh +++ b/src/bin/initdb/initdb.sh @@ -27,7 +27,7 @@ # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # -# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.158 2002/07/16 17:48:46 tgl Exp $ +# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.159 2002/07/18 02:02:30 ishii Exp $ # #------------------------------------------------------------------------- @@ -994,6 +994,11 @@ EOF | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely echo "ok" +# Create pg_conversion and support functions +$ECHO_N "creating conversions... "$ECHO_C +cat $datadir/conversion_create.sql | "$PGPATH"/postgres $PGSQL_OPT template1 > /dev/null || exit_nicely +echo "ok" + # Set most system catalogs and built-in functions as world-accessible. # Some objects may require different permissions by default, so we # make sure we don't overwrite privilege sets that have already been diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index f28af37d931..f99f909f285 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.73 2002/07/15 01:56:25 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.74 2002/07/18 02:02:30 ishii Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -38,14 +38,7 @@ #include "print.h" #include "settings.h" #include "variables.h" - -#ifdef MULTIBYTE #include "mb/pg_wchar.h" -#else -/* Grand unified hard-coded badness */ -#define pg_encoding_to_char(x) "SQL_ASCII" -#endif - /* functions for use in this file */ @@ -457,10 +450,9 @@ exec_command(const char *cmd, puts(pg_encoding_to_char(pset.encoding)); else { -#ifdef MULTIBYTE /* set encoding */ if (PQsetClientEncoding(pset.db, encoding) == -1) - psql_error("%s: invalid encoding name\n", encoding); + psql_error("%s: invalid encoding name or conversion proc not found\n", encoding); else { @@ -468,9 +460,6 @@ exec_command(const char *cmd, pset.encoding = PQclientEncoding(pset.db); SetVariable(pset.vars, "ENCODING", pg_encoding_to_char(pset.encoding)); } -#else - psql_error("\\%s: multibyte support is not enabled\n", cmd); -#endif free(encoding); } } |
