Re: Field with default not being set on copy from. - Mailing list pgsql-general

From Tom Lane
Subject Re: Field with default not being set on copy from.
Date
Msg-id 11423.1041628105@sss.pgh.pa.us
Whole thread Raw
In response to Field with default not being set on copy from.  (Jean-Luc Lachance <jllachan@nsd.ca>)
List pgsql-general
Jean-Luc Lachance <jllachan@nsd.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: postmaster.pid
Next
From: Tom Lane
Date:
Subject: Re: boolean over char(1)