replace?? - Mailing list pgsql-sql

From bboett@erm1.u-strasbg.fr (Bruno Boettcher)
Subject replace??
Date
Msg-id 20001219133752.C9283@erm1.u-strasbg.fr
Whole thread Raw
Responses Re: replace??
List pgsql-sql
hello,

i have the following problem:
i have in php an array structure with user-prefs that have to be stored
onto DB....

actually i look up if the corresponding entry exists (comparing
user-name and field-name) if yes i update, if no i insert....

this isn't very appealing, but i couldn't find another way yet to make
this shorter...

would be nice if something like the following existed:

replace settings set auser='toto',field='lang',data='fr' where
auser='toto' and field='lang';

update settings set auser='toto',field='lang',data='fr' where
auser='toto' and field='lang' REPLACE;

or even better:

replace settings keys(auser,field) set auser='toto',field='lang',data='fr';


-- 
ciao bboett
==============================================================
bboett@earthling.net
http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett
===============================================================
the total amount of intelligence on earth is constant.
human population is growing....


pgsql-sql by date:

Previous
From: Tulassay Zsolt
Date:
Subject: Re: Tree structure table normalization problem (do I need a trigger?)
Next
From: "Brett W. McCoy"
Date:
Subject: Re: replace??