Alter table add column ignores default

Поиск
Список
Период
Сортировка
От pgsql-bugs@postgresql.org
Тема Alter table add column ignores default
Дата
Msg-id 200105051623.f45GNbf91481@hub.org
обсуждение исходный текст
Ответы Re: Alter table add column ignores default  (Nabil Sayegh <nsmail@sayegh.de>)
Список pgsql-bugs
Vince Vielhaber (vev@hub.org) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Alter table add column ignores default

Long Description
Alter table add column ignores the default values in both v7.0x and 7.1.  In the example code the table is created with
onecolumn having a default value of 'none'.  An ALTER TABLE is done adding another varchar column also with a default
value. \d table only shows the default from the create, not the alter.  An insert also fails to add the default. 



Sample Code
foo=# create table foobar(name varchar(20),nickname varchar(10) default 'none');
CREATE
foo=# \d foobar
              Table "foobar"
 Attribute |    Type     |    Modifier
-----------+-------------+----------------
 name      | varchar(20) |
 nickname  | varchar(10) | default 'none'

foo=# alter table foobar add column address varchar(50) default 'none';
ALTER
foo=# \d foobar
              Table "foobar"
 Attribute |    Type     |    Modifier
-----------+-------------+----------------
 name      | varchar(20) |
 nickname  | varchar(10) | default 'none'
 address   | varchar(50) |

foo=# insert into foobar(name) values('Joe Postgres');
INSERT 313396 1
foo=# select * from foobar;
     name     | nickname | address
--------------+----------+---------
 Joe Postgres | none     |
(1 row)

foo=#



No file was uploaded with this report

В списке pgsql-bugs по дате отправления:

Предыдущее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #307 resolved (concerned timestamp problems)
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Build fails for pl/tcl on OpenBSD