COPY, \copy with defaults

From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: COPY, \copy with defaults
Date: 2004-08-09 04:31:35
Message-ID: 20040809043135.58459.qmail@web52909.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I guess this is a feature request since I can't figure
out a way to do it directly in postgresql (plus
COPY/\copy isn't in SQL specs). Often when I import
data I need to assign foreign key id's, timestamps,
etc. How about a syntax something like:

\copy tablename (col1, col2, col3, fkid=8,
ts1='2004-8-8') from 'data.csv'

or maybe add a defaults clause after "with":

\copy tablename (col1, col2, col3) from 'data.csv'
with defaults (fkid=8,ts1='2004-8-8')

Or if anybody knows of a better/existing way please
feel free. :)

CSN

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message CSN 2004-08-09 04:37:03 PostgreSQL 8.0 Feature List?
Previous Message Jan Wieck 2004-08-09 03:31:27 Re: PostgreSQL 7.4.2 allows foreign key violation