Lists: | pgsql-general |
---|
From: | "Robert Ngo" <robertngo(at)perridot(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | need help with copy function |
Date: | 2004-08-19 08:47:55 |
Message-ID: | 000801c485c9$396a3940$1b01230a@perridot.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
copy swpparm from stdin using delimiters ';';
exampaper;02;1;Bahasa Melayu;M;A;2002-11-27;system;;
\.
why does the above command return a error message
ERROR: copy: line 1, Bad date external representation ''
PQendcopy: resetting connection
From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Robert Ngo <robertngo(at)perridot(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: need help with copy function |
Date: | 2004-08-20 12:45:56 |
Message-ID: | 20040820124556.GA20737@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
On Thu, Aug 19, 2004 at 16:47:55 +0800,
Robert Ngo <robertngo(at)perridot(dot)com> wrote:
> copy swpparm from stdin using delimiters ';';
>
> exampaper;02;1;Bahasa Melayu;M;A;2002-11-27;system;;
>
> \.
>
> why does the above command return a error message
It looks like the column that is associated with the empty field has a
type of date. The empty string is not a valid date. If you want a NULL
date then you need to use \N instead of an empty string.
>
>
> ERROR: copy: line 1, Bad date external representation ''
> PQendcopy: resetting connection
>
From: | Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com> |
---|---|
To: | Robert Ngo <robertngo(at)perridot(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: need help with copy function |
Date: | 2004-08-20 13:47:24 |
Message-ID: | 20040820134724.34137.qmail@web20822.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-general |
--- Robert Ngo <robertngo(at)perridot(dot)com> wrote:
> copy swpparm from stdin using delimiters ';';
>
> exampaper;02;1;Bahasa Melayu;M;A;2002-11-27;system;;
>
>
> \.
>
> why does the above command return a error message
>
>
> ERROR: copy: line 1, Bad date external
> representation ''
> PQendcopy: resetting connection
>
An empty string is not a valid date.
I am guessing that you just wanted the absent value(s)
to be inserted as nulls. If so, just add "with null
as ''" (that's two single quotes) to your "copy"
statement.
>
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush