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

Commit3be2448

Browse files
committed
Add an explicit caution about how to use pg_do_encoding_conversion with
non-null-terminated input. Per discussion with ITAGAKI Takahiro.
1 parenta4917be commit3be2448

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/utils/mb/mbutils.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (currently mule internal code (mic) is used)
55
* Tatsuo Ishii
66
*
7-
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.74 2008/11/10 15:18:40 tgl Exp $
7+
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.75 2008/11/11 03:01:20 tgl Exp $
88
*/
99
#include"postgres.h"
1010

@@ -221,8 +221,14 @@ pg_get_client_encoding_name(void)
221221
* it's taken from pg_catalog schema. If it even is not in the schema,
222222
* warn and return src.
223223
*
224+
* If conversion occurs, a palloc'd null-terminated string is returned.
224225
* In the case of no conversion, src is returned.
225226
*
227+
* CAUTION: although the presence of a length argument means that callers
228+
* can pass non-null-terminated strings, care is required because the same
229+
* string will be passed back if no conversion occurs. Such callers *must*
230+
* check whether result == src and handle that case differently.
231+
*
226232
* Note: we try to avoid raising error, since that could get us into
227233
* infinite recursion when this function is invoked during error message
228234
* sending. It should be OK to raise error for overlength strings though,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp