Re: [SQL] multi-column unique constraints with nullable columns

2005-05-05 Thread Mikey
It may be possible to bypass the NULL != NULL by using coalesce. Here is an example: create table foo2 ( a integer not null, b integer not null, c integer null, UNIQUE (a,b,c) ); create function foo2_unique_func() RETURNS trigger AS ' DECLARE isfound integer = 0; BEGIN isfound =

Re: [SQL] HELP: aggregating insert rule for multirow inserts.

2005-05-05 Thread Mikey
What about this as a rule. It seems to work for me. create or replace rule critter_counter as on INSERT to critter do ( insert into zoostats select distinct new.legs where new.legs not in (select legs from zoostats); update zoostats set headcount = ( select c