Re: Is there a solution for "SELECT OR INSERT"

From: Florian Weimer <fweimer(at)bfk(dot)de>
To: <pgsql(at)yukonho(dot)de>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Is there a solution for "SELECT OR INSERT"
Date: 2010-11-30 14:16:23
Message-ID: 82aakq99s8.fsf@mid.bfk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Stefan Becker:

> Is there a way to get the ID row OR create a new one in
> ONE single statement?

You could create a stored procedure. But if you have concurrent
inserts, locking is a bit tricky.

--
Florian Weimer <fweimer(at)bfk(dot)de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargent 2010-11-30 17:42:47 indexing longish string
Previous Message Carla 2010-11-30 13:22:43 Re: subselect and left join not working?