aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2007-02-05 15:23:24 +0000
committerAndrew Dunstan <andrew@dunslane.net>2007-02-05 15:23:24 +0000
commite7c63e522c3bc488ab95060e224c131970516f0c (patch)
treedce4a11cf8a851804aff863f9af143f039a64096 /src
parent54111e95118a311a0db3c5745d0fa1bc9114281d (diff)
downloadpostgresql-e7c63e522c3bc488ab95060e224c131970516f0c.tar.gz
postgresql-e7c63e522c3bc488ab95060e224c131970516f0c.zip
Pass modern COPY syntax to backend, since copy (query) does not accept old syntax. Per complaint from Michael Fuhr.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/copy.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index 623ed36ae0b..f43ce258c3d 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -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->binary)
+ appendPQExpBuffer(&query, " BINARY ");
+
+ if (options->oids)
+ appendPQExpBuffer(&query, " OIDS ");
+
if (options->delim)
- emit_copy_option(&query, " USING DELIMITERS ", 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");