public inbox for [email protected]  
help / color / mirror / Atom feed
Adding a Column: default values now allowed
2+ messages / 2 participants
[nested] [flat]

* Adding a Column: default values now allowed
@ 2005-01-09 07:41 Michael Fuhr <[email protected]>
  2005-01-09 16:57 ` Re: Adding a Column: default values now allowed Tom Lane <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Michael Fuhr @ 2005-01-09 07:41 UTC (permalink / raw)
  To: pgsql-docs

PostgreSQL 8.0.0rc4

5.6.1 "Adding a Column" says:

  Also, you cannot define a default value on a new column.  According
  to the SQL standard, this would have to fill the new columns in the
  existing rows with the default value, which is not implemented yet.

Adding a column with a default appears to be implemented now:

CREATE TABLE foo (label text);
INSERT INTO foo VALUES ('item 1');
INSERT INTO foo VALUES ('item 2');
INSERT INTO foo VALUES ('item 3');
ALTER TABLE foo ADD COLUMN value integer DEFAULT 123;
SELECT * FROM foo;
 label  | value 
--------+-------
 item 1 |   123
 item 2 |   123
 item 3 |   123
(3 rows)

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Adding a Column: default values now allowed
  2005-01-09 07:41 Adding a Column: default values now allowed Michael Fuhr <[email protected]>
@ 2005-01-09 16:57 ` Tom Lane <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2005-01-09 16:57 UTC (permalink / raw)
  To: Michael Fuhr <[email protected]>; +Cc: pgsql-docs

Michael Fuhr <[email protected]> writes:
> PostgreSQL 8.0.0rc4
> 5.6.1 "Adding a Column" says:

>   Also, you cannot define a default value on a new column.  According
>   to the SQL standard, this would have to fill the new columns in the
>   existing rows with the default value, which is not implemented yet.

Drat, I thought I'd caught all those.  Thanks.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-01-09 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-09 07:41 Adding a Column: default values now allowed Michael Fuhr <[email protected]>
2005-01-09 16:57 ` Tom Lane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox