lack of consequence with domains and types
От | Grzegorz Jaśkiewicz |
---|---|
Тема | lack of consequence with domains and types |
Дата | |
Msg-id | 2f4958ff0812220449s8c60738p9327891c0c60318c@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: lack of consequence with domains and types
Re: lack of consequence with domains and types |
Список | pgsql-general |
so, consider this one: create sequence seq1; create domain foo1 as bigint default nextval('seq1') not null; create domain foo2 as timestamp without time zone default now() not null; create type footype as ( a foo1, b foo2 ) ; create table bar(a bigint not null, b varchar(20)); insert into bar(a) select generate_series(1,100); alter table bar add column blah footype not null; ERROR: column "blah" contains null values :/ I was expecting domains to kick in with their default values again. I presume this is somehow similar to problem with enums I raised before. Obviously I can work around that thing with: create sequence seq1; create type footype as ( a bigint, b timestamp without time zone ); create table bar(a bigint not null, b varchar(20)); insert into bar(a) select generate_series(1,100); alter table bar add column blah footype not null default ( nextval('seq1'), now()) ; but that defeats whole purpose of domains, doesn't it ? well, on top of that - I could create another domain with default (nextval, now), but still.... The feature of domains and types is really great, but I see a lack of consequence here. It would be great to see that fixed in future versions of pg. Thanks :) -- GJ
В списке pgsql-general по дате отправления: