Re: Field with default not being set on copy from.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Field with default not being set on copy from.
Date: 2003-01-03 21:08:25
Message-ID: 11423.1041628105@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jean-Luc Lachance <jllachan(at)nsd(dot)ca> writes:
> It seems that a field declared with a default is not being set when
> executing copy from with less field then the table has.

I think you are mistaken. This works in 7.3:

regression=# create table foo (f1 int, f2 text, f3 int default 42);
CREATE TABLE
regression=# \copy foo(f1,f2) from stdin
1 first
2 second
\.
regression=# select * from foo;
f1 | f2 | f3
----+--------+----
1 | first | 42
2 | second | 42
(2 rows)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-01-03 21:27:21 Re: boolean over char(1)
Previous Message Tom Lane 2003-01-03 21:03:47 Re: postmaster.pid