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

Commit4a72dbc

Browse files
committed
The attached applied patch throws an error if the delimiter appears in
the COPY NULL string: test=> copy pg_language to '/tmp/x' with delimiter '|'; COPY test=> copy pg_language to '/tmp/x' with delimiter '|' null '|x'; ERROR: COPY delimiter must not appear in the NULL specification test=> copy pg_language from '/tmp/x' with delimiter '|' null '|x'; ERROR: COPY delimiter must not appear in the NULL specificationIt also throws an error if it conflicts with the default NULL string: test=> copy pg_language to '/tmp/x' with delimiter '\\'; ERROR: COPY delimiter must not appear in the NULL specification test=> copy pg_language to '/tmp/x' with delimiter '\\' NULL 'x'; COPY
1 parent5e9f4d2 commit4a72dbc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/backend/commands/copy.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.218 2004/02/10 01:55:24 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.219 2004/04/06 13:21:33 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -779,6 +779,14 @@ DoCopy(const CopyStmt *stmt)
779779
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
780780
errmsg("COPY delimiter must be a single character")));
781781

782+
/*
783+
* Don't allow the delimiter to appear in the null string.
784+
*/
785+
if (strchr(null_print,delim[0])!=NULL)
786+
ereport(ERROR,
787+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
788+
errmsg("COPY delimiter must not appear in the NULL specification")));
789+
782790
/*
783791
* Don't allow COPY w/ OIDs to or from a table without them
784792
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp