diff options
author | Tatsuo Ishii <ishii@postgresql.org> | 2000-08-22 12:59:04 +0000 |
---|---|---|
committer | Tatsuo Ishii <ishii@postgresql.org> | 2000-08-22 12:59:04 +0000 |
commit | bc2cf76a591f6fb10edd5272da8ba74f4dd1fec2 (patch) | |
tree | 6f9667d5f1965f4cc0044d13d2c4f50357616e24 | |
parent | 88d7b4a2502b481d6aff3e6563577f190b53b7f1 (diff) | |
download | postgresql-bc2cf76a591f6fb10edd5272da8ba74f4dd1fec2.tar.gz postgresql-bc2cf76a591f6fb10edd5272da8ba74f4dd1fec2.zip |
Make makeObjectName multibyte aware. Currently, it may produce
incorrect multibyte sequence while truncating too long names.
-rw-r--r-- | src/backend/parser/analyze.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index be6009f7000..f3cad18de86 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: analyze.c,v 1.154 2000/08/11 23:45:27 tgl Exp $ + * $Id: analyze.c,v 1.155 2000/08/22 12:59:04 ishii Exp $ * *------------------------------------------------------------------------- */ @@ -30,6 +30,10 @@ #include "utils/relcache.h" #include "utils/syscache.h" +#ifdef MULTIBYTE +#include "mb/pg_wchar.h" +#endif + void CheckSelectForUpdate(Query *qry); /* no points for style... */ static Query *transformStmt(ParseState *pstate, Node *stmt); @@ -550,6 +554,13 @@ makeObjectName(char *name1, char *name2, char *typename) name2chars--; } +#ifdef MULTIBYTE + if (name1) + name1chars = pg_mbcliplen(name1, name1chars, name1chars); + if (name2) + name2chars = pg_mbcliplen(name2, name2chars, name2chars); +#endif + /* Now construct the string using the chosen lengths */ name = palloc(name1chars + name2chars + overhead + 1); strncpy(name, name1, name1chars); |