From: | Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | lack of consequence with domains and types |
Date: | 2008-12-22 12:49:49 |
Message-ID: | 2f4958ff0812220449s8c60738p9327891c0c60318c@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Grzegorz Jaśkiewicz | 2008-12-22 12:53:58 | Re: lack of consequence with domains and types |
Previous Message | Geoffrey | 2008-12-22 12:37:34 | Re: How are locks managed in PG? |