replace??

From: bboett(at)erm1(dot)u-strasbg(dot)fr (Bruno Boettcher)
To: pgsql-sql(at)postgresql(dot)org
Subject: replace??
Date: 2000-12-19 12:37:52
Message-ID: 20001219133752.C9283@erm1.u-strasbg.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)earthling(dot)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....

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Brett W. McCoy 2000-12-19 13:08:09 Re: replace??
Previous Message juerg.rietmann 2000-12-19 09:59:17 SQL query not working when GROUP BY / HAVING is used