This patch brings the \copy syntax of psql more in line with the SQL copy
syntax as described in the reference manual, while maintaining backward
compatibility with what was there prior to the patch.
The change to the syntax is to the DELIMITER[S] portion.
The man page for psql refers the reader to the SQL copy command docs for
details of syntax. The SQL docs state that the syntax for COPY is
... [ DELIMITER [ AS ] 'delimiter' ] ...
(7.4 docs), while 7.2 docs
use the syntax:
... [ [USING] DELIMITERS 'delimiter' ]
Reading through the psql source code, it's obvious that at one time, the
... [ WITH DELIMITER 'delimiter' ] ...
The patch results in the following syntax for the DELIMITER clause of
[ [WITH|USING] DELIMITER[S] 'delimiter' ]
Ideally, this should cover all cases of old and new syntax, except where
"AS" is present. The only drawback I can see is that \copy is now more
liberal in what it accepts, and may accept incomplete statements
without issuing an error (i.e. a WITH or USING clause at the end of a
\copy statement will simply be ignored, and no error generated)
This patch is against version 1.36 of src/bin/psql/copy.c
The resulting psql binary (based off a cvsup from HEAD on 1/18) compiles
and works for me on FreeBSD 5.1.
Description: text/plain (2.4 KB)
pgsql-patches by date
|Next:||From: Peter Eisentraut||Date: 2004-01-18 21:47:18|
|Subject: Re: [patch] Postgres 7.4 - doc INSTALL/Cygwin|
|Previous:||From: Jari Aalto||Date: 2004-01-17 11:37:48|
|Subject: [patch] INSTALL doc note (was Re: BUG #1051: Cannot remove