mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-05 19:09:58 +08:00
Pass modern COPY syntax to backend, since copy (query) does not accept old syntax. Per complaint from Michael Fuhr.
This commit is contained in:
parent
54111e9511
commit
e7c63e522c
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2006, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.71 2006/11/24 23:06:50 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.71.2.1 2007/02/05 15:23:24 adunstan Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
#include "copy.h"
|
||||
@ -268,7 +268,7 @@ parse_slash_copy(const char *args)
|
||||
0, false, false, pset.encoding);
|
||||
|
||||
/*
|
||||
* Allows old COPY syntax for backward compatibility 2002-06-19
|
||||
* Allows old COPY syntax for backward compatibility.
|
||||
*/
|
||||
if (token && pg_strcasecmp(token, "using") == 0)
|
||||
{
|
||||
@ -480,32 +480,28 @@ do_copy(const char *args)
|
||||
|
||||
printfPQExpBuffer(&query, "COPY ");
|
||||
|
||||
/* Uses old COPY syntax for backward compatibility 2002-06-19 */
|
||||
if (options->binary)
|
||||
appendPQExpBuffer(&query, "BINARY ");
|
||||
|
||||
appendPQExpBuffer(&query, "%s ", options->table);
|
||||
|
||||
if (options->column_list)
|
||||
appendPQExpBuffer(&query, "%s ", options->column_list);
|
||||
|
||||
/* Uses old COPY syntax for backward compatibility 2002-06-19 */
|
||||
if (options->oids)
|
||||
appendPQExpBuffer(&query, "WITH OIDS ");
|
||||
|
||||
if (options->from)
|
||||
appendPQExpBuffer(&query, "FROM STDIN");
|
||||
else
|
||||
appendPQExpBuffer(&query, "TO STDOUT");
|
||||
|
||||
|
||||
/* Uses old COPY syntax for backward compatibility 2002-06-19 */
|
||||
if (options->delim)
|
||||
emit_copy_option(&query, " USING DELIMITERS ", options->delim);
|
||||
if (options->binary)
|
||||
appendPQExpBuffer(&query, " BINARY ");
|
||||
|
||||
if (options->oids)
|
||||
appendPQExpBuffer(&query, " OIDS ");
|
||||
|
||||
if (options->delim)
|
||||
emit_copy_option(&query, " DELIMITER ", options->delim);
|
||||
|
||||
/* There is no backward-compatible CSV syntax */
|
||||
if (options->null)
|
||||
emit_copy_option(&query, " WITH NULL AS ", options->null);
|
||||
emit_copy_option(&query, " NULL AS ", options->null);
|
||||
|
||||
if (options->csv_mode)
|
||||
appendPQExpBuffer(&query, " CSV");
|
||||
|
Loading…
Reference in New Issue
Block a user