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

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to