Skip site navigation (1) Skip section navigation (2)

COPY doesn't like my dates on STDIN

From: James Long <pgsql-novice(at)museum(dot)rain(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: COPY doesn't like my dates on STDIN
Date: 2008-03-19 03:31:41
Message-ID: 20080319033141.GA63526@ns.umpquanet.com (view raw or flat)
Thread:
Lists: pgsql-novice
I'm trying to

copy temp_table ( id, date_created ) from stdin;
TME     2008-03-18
\.

pgsql says:

ERROR:  column "date_created" is of type date but expression is of type character
HINT:  You will need to rewrite or cast the expression.

I basically grok what it is saying, but the "expression" is in the
STDIN stream.  How do I cast that?  And I also don't get why my 
pg_dump backup scripts use this same syntax but I can't.

One such pg_dump-created file says:

COPY tickets (ticket_number, reservation_number, travel_date, issue_date, ... )
FROM stdin;
2115492091826   11ACFD  2006-08-28      \N      ...

Certainly, no criticism intended.  I really enjoy PG.  Just
confusion on my part is all.

Thank you,

Jim

Responses

pgsql-novice by date

Next:From: John DeSoiDate: 2008-03-19 04:36:01
Subject: Re: Database Classes and prepared statements
Previous:From: G. J. WalshDate: 2008-03-18 22:25:15
Subject: Database Classes and prepared statements

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group