Re: Conditional INSERT: if not exists

From: "Don Morrison" <donmorrison(at)gmail(dot)com>
To: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Conditional INSERT: if not exists
Date: 2006-08-22 15:58:41
Message-ID: aee6519f0608220858p14437461kc2c094eb3c064c2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> > I want to insert a row unless it exists already. Do I have to write a
> > stored procedure to do this?
>[...]
> isn't a problem. If you need to do this in a transaction, you can
> simply set savepoints and roll back to the savepoint if an insert fails
> (and you expected that it could).

Yes, that's the problem: I have it in one transaction which I don't
want to fail on error. I'll look into the savepoint method.
Specifically the transaction I'm writing is a "Z SQL Method" in Zope
(a page templating system and web server).

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ray Stell 2006-08-22 16:19:13 response time data
Previous Message ben sewell 2006-08-22 13:57:15 Passing parameters to postgreSQL from MS Access 2000