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

Commita90e9d6

Browse files
committed
Inserting 5 characters into char(10) does not produce 5 padding spaces
if they are two-byte multibyte characters. Same thing can be happenif octet_length(multibyte_chars) == n where n is char(n).Long standing bug since 7.3 days. Per report and fix from Yoshiyuki Asaba.
1 parent11a0c37 commita90e9d6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎src/backend/parser/parse_expr.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.181 2005/04/06 16:34:06 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.182 2005/05/24 15:45:34 ishii Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -18,6 +18,7 @@
1818
#include"catalog/pg_operator.h"
1919
#include"catalog/pg_proc.h"
2020
#include"commands/dbcommands.h"
21+
#include"mb/pg_wchar.h"
2122
#include"miscadmin.h"
2223
#include"nodes/makefuncs.h"
2324
#include"nodes/params.h"
@@ -34,7 +35,6 @@
3435
#include"utils/lsyscache.h"
3536
#include"utils/syscache.h"
3637

37-
3838
boolTransform_null_equals= false;
3939

4040
staticNode*transformParamRef(ParseState*pstate,ParamRef*pref);
@@ -1553,7 +1553,13 @@ exprTypmod(Node *expr)
15531553
{
15541554
caseBPCHAROID:
15551555
if (!con->constisnull)
1556-
returnVARSIZE(DatumGetPointer(con->constvalue));
1556+
{
1557+
int32len=VARSIZE(DatumGetPointer(con->constvalue))-VARHDRSZ;
1558+
1559+
if (pg_database_encoding_max_length()>1)
1560+
len=pg_mbstrlen_with_len(VARDATA(DatumGetPointer(con->constvalue)),len);
1561+
returnlen+VARHDRSZ;
1562+
}
15571563
break;
15581564
default:
15591565
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp