> > Check existence and then insert or update. If you want, I guess
> you could
> > wrap that inside a stored procedure.
> >
> Well, that's a good idea :-) but I'm not sure about how to create
> such procedure. I would appreciate Your help.
Quite frankly, I'm not sure either. I'm just starting with PostgreSQL, what
I really know is Oracle. I believe it would be something like
...
[declare routine, with one argument per record field]
...
if exists(select 1 from table_name where [field_key] = [arg_key]) then update table_name set field1 = arg1,...,fieldn
=argn where field_key = arg_key;
else insert into table_name (field1,...,fieldn) values (arg1,...,argn);
end if;
...
The syntax is probably off, but that's the idea. I used that several times
on oracle.