Don't know if this will get attached to the conversation, but here is how 
I have dealt with this.

insert into names (name, created_date) values ($1, default);
update names n set created_date = coalesce($2, n.craeted_date) where name 
= $1;

So basically insert all of your non-defaulted columns with the primary 
key.  This will put the defaults into the table.  Then update with 
coalesce the values passed into the proc.  The coalesce will use the 
parameter unless it is NULL.  If it is NULL it will use the default from 
the table.  This is inefficient since it will version the row in the table 
for each call to the proc.

Brent DeSpain

Reply via email to