Re: [BUGS] psql \COPY accepts multiple NULL AS

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] psql \COPY accepts multiple NULL AS
Date: 2008-03-11 23:31:27
Message-ID: 200803112331.m2BNVRL29523@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

Stephen Frost wrote:
-- Start of PGP signed section.
> Greetings,
>
> psql seems to accept syntax which would be rejected by the server,
> which seems a bit odd:
>
> sfrost*=# \copy billing_data from ../BillingSamplePricerFile.csv
> with csv header quote as '"' null as 'abc' null as '123'
> ERROR: invalid input syntax for integer: ""
>
> vs.
>
> sfrost=# copy billing_data from stdin
> with csv header quote as '"' null as 'abc' null as '123';
> ERROR: conflicting or redundant options
>
> Now, honestly, I'd like to see support for multiple 'NULL AS' strings,
> but till that's added it'd probably be best if psql error'd on this
> like the backend does rather than accepting it and then not doing it.

I have fixed this bug with the attached patch to CVS HEAD.

test=> \copy billing_data from ../BillingSamplePricerFile.csv with csv
header quote as '"' null as 'abc' null as '123'
\copy: parse error at "null"

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 2.1 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-03-12 01:01:32 Re: BUG #4027: backslash escaping not disabled in plpgsql
Previous Message Jonathan Guthrie 2008-03-11 21:26:56 BUG #4027: backslash escaping not disabled in plpgsql

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2008-03-12 00:34:17 Re: Proposed patch for LISTEN/NOTIFY race condition
Previous Message Tom Lane 2008-03-11 23:21:04 Proposed patch for LISTEN/NOTIFY race condition