Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Grzegorz Jaśkiewicz
I hope Tom can hear my prayers. This basically means, I won't be able to use domains+type in my designs. :/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Merlin Moncure
On Wed, Dec 24, 2008 at 6:41 PM, Erik Jones ejo...@engineyard.com wrote: On Dec 24, 2008, at 12:04 PM, Grzegorz Jaśkiewicz wrote: On Wed, Dec 24, 2008 at 6:12 PM, Erik Jones ejo...@engineyard.com wrote: Yes, and columns have default values, too, which are not tied to their datatype's

Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Grzegorz Jaśkiewicz
another glance at source code, and docs tells me - that there's not such thing as default value for custom type - unless that type is defined as new base scalar type. So probably, that would require postgresql to allow users to define default values for composite types as well, like that: create

Re: [GENERAL] lack of consequence with domains and types

2008-12-26 Thread Merlin Moncure
On Fri, Dec 26, 2008 at 3:57 PM, Grzegorz Jaśkiewicz gryz...@gmail.com wrote: another glance at source code, and docs tells me - that there's not such thing as default value for custom type - unless that type is defined as new base scalar type. So probably, that would require postgresql to

Re: [GENERAL] lack of consequence with domains and types

2008-12-25 Thread Grzegorz Jaśkiewicz
gj=# create domain dfoo as varchar(20) default 'bollocks' not null; CREATE DOMAIN Time: 1680,908 ms gj=# create table foo( a bigserial not null, b int default (random()*100)::int not null ); NOTICE: CREATE TABLE will create implicit sequence foo_a_seq for serial column foo.a CREATE TABLE Time:

Re: [GENERAL] lack of consequence with domains and types

2008-12-24 Thread Erik Jones
On Dec 22, 2008, at 1:08 PM, Grzegorz Jaśkiewicz wrote: On Mon, Dec 22, 2008 at 6:10 PM, Erik Jones ejo...@engineyard.com wrote: As mentioned above, by fixing the behavior to be what you're expecting you'd be breaking the defined behavior of ALTER TABLE. I don't understand. The domain's

Re: [GENERAL] lack of consequence with domains and types

2008-12-24 Thread Grzegorz Jaśkiewicz
On Wed, Dec 24, 2008 at 6:12 PM, Erik Jones ejo...@engineyard.com wrote: Yes, and columns have default values, too, which are not tied to their datatype's default value (if it even has one). ALTER TABLE initializes rows to have the new *column's* default. A column of some domain type could

Re: [GENERAL] lack of consequence with domains and types

2008-12-24 Thread Erik Jones
On Dec 24, 2008, at 12:04 PM, Grzegorz Jaśkiewicz wrote: On Wed, Dec 24, 2008 at 6:12 PM, Erik Jones ejo...@engineyard.com wrote: Yes, and columns have default values, too, which are not tied to their datatype's default value (if it even has one). ALTER TABLE initializes rows to have the

[GENERAL] lack of consequence with domains and types

2008-12-22 Thread Grzegorz Jaśkiewicz
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

Re: [GENERAL] lack of consequence with domains and types

2008-12-22 Thread Grzegorz Jaśkiewicz
On Mon, Dec 22, 2008 at 1:49 PM, Grzegorz Jaśkiewicz gryz...@gmail.com wrote: 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 Well I can't, it doesn't work :( create domain xyz as footype

Re: [GENERAL] lack of consequence with domains and types

2008-12-22 Thread Erik Jones
On Dec 22, 2008, at 4:49 AM, Grzegorz Jaśkiewicz wrote: 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 ) ;

Re: [GENERAL] lack of consequence with domains and types

2008-12-22 Thread Grzegorz Jaśkiewicz
On Mon, Dec 22, 2008 at 6:10 PM, Erik Jones ejo...@engineyard.com wrote: As mentioned above, by fixing the behavior to be what you're expecting you'd be breaking the defined behavior of ALTER TABLE. I don't understand. The domain's have default values, how will it break alter table ? Please