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

Commit00ade1d

Browse files
committed
Pass modern COPY syntax to backend, since copy (query) does not accept old syntax. Per complaint from Michael Fuhr.
1 parent23c4978 commit00ade1d

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

‎src/bin/psql/copy.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.72 2007/01/05 22:19:49 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.73 2007/02/0515:22:18 adunstan Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"copy.h"
@@ -268,7 +268,7 @@ parse_slash_copy(const char *args)
268268
0, false, false,pset.encoding);
269269

270270
/*
271-
* Allows old COPY syntax for backward compatibility 2002-06-19
271+
* Allows old COPY syntax for backward compatibility.
272272
*/
273273
if (token&&pg_strcasecmp(token,"using")==0)
274274
{
@@ -480,32 +480,28 @@ do_copy(const char *args)
480480

481481
printfPQExpBuffer(&query,"COPY ");
482482

483-
/* Uses old COPY syntax for backward compatibility 2002-06-19 */
484-
if (options->binary)
485-
appendPQExpBuffer(&query,"BINARY ");
486-
487483
appendPQExpBuffer(&query,"%s ",options->table);
488484

489485
if (options->column_list)
490486
appendPQExpBuffer(&query,"%s ",options->column_list);
491487

492-
/* Uses old COPY syntax for backward compatibility 2002-06-19 */
493-
if (options->oids)
494-
appendPQExpBuffer(&query,"WITH OIDS ");
495-
496488
if (options->from)
497489
appendPQExpBuffer(&query,"FROM STDIN");
498490
else
499491
appendPQExpBuffer(&query,"TO STDOUT");
500492

501493

502-
/* Uses old COPY syntax for backward compatibility 2002-06-19 */
494+
if (options->binary)
495+
appendPQExpBuffer(&query," BINARY ");
496+
497+
if (options->oids)
498+
appendPQExpBuffer(&query," OIDS ");
499+
503500
if (options->delim)
504-
emit_copy_option(&query,"USING DELIMITERS ",options->delim);
501+
emit_copy_option(&query,"DELIMITER ",options->delim);
505502

506-
/* There is no backward-compatible CSV syntax */
507503
if (options->null)
508-
emit_copy_option(&query,"WITHNULL AS ",options->null);
504+
emit_copy_option(&query," NULL AS ",options->null);
509505

510506
if (options->csv_mode)
511507
appendPQExpBuffer(&query," CSV");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp