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

Commitbc2cf76

Browse files
committed
Make makeObjectName multibyte aware. Currently, it may produce
incorrect multibyte sequence while truncating too long names.
1 parent88d7b4a commitbc2cf76

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎src/backend/parser/analyze.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Id: analyze.c,v 1.154 2000/08/11 23:45:27 tgl Exp $
9+
*$Id: analyze.c,v 1.155 2000/08/22 12:59:04 ishii Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -30,6 +30,10 @@
3030
#include"utils/relcache.h"
3131
#include"utils/syscache.h"
3232

33+
#ifdefMULTIBYTE
34+
#include"mb/pg_wchar.h"
35+
#endif
36+
3337
voidCheckSelectForUpdate(Query*qry);/* no points for style... */
3438

3539
staticQuery*transformStmt(ParseState*pstate,Node*stmt);
@@ -550,6 +554,13 @@ makeObjectName(char *name1, char *name2, char *typename)
550554
name2chars--;
551555
}
552556

557+
#ifdefMULTIBYTE
558+
if (name1)
559+
name1chars=pg_mbcliplen(name1,name1chars,name1chars);
560+
if (name2)
561+
name2chars=pg_mbcliplen(name2,name2chars,name2chars);
562+
#endif
563+
553564
/* Now construct the string using the chosen lengths */
554565
name=palloc(name1chars+name2chars+overhead+1);
555566
strncpy(name,name1,name1chars);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp