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

Re: What am I doing wrong with this comma-delimited copy?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Long <pgsql-novice(at)museum(dot)rain(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: What am I doing wrong with this comma-delimited copy?
Date: 2007-04-04 00:18:00
Message-ID: 13974.1175645880@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
James Long <pgsql-novice(at)museum(dot)rain(dot)com> writes:
> james=> \pset fieldsep ,
> Field separator is ",".
> james=> \copy transactions from bar

> psql appears to be treating the entire input line as one tuple,
> instead of seeing the fieldsep value as a field delimiter.

You're confusing psql's output field separator with what COPY will use.
IIRC you need a "delimiter ','" clause on the copy command.

> Also, one issue I can see coming is the date format.  Is there
> a way I can read M-D-Y (or M/D/Y) format dates and store them?

See datestyle.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Peter SchonefeldDate: 2007-04-04 01:36:40
Subject: looping multi-dimensional array
Previous:From: Sean DavisDate: 2007-04-03 22:49:49
Subject: Re: What am I doing wrong with this comma-delimited copy?

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