Testing for existence of a record before insert

From: "Rob Anderson" <roba(at)bml(dot)uk(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Testing for existence of a record before insert
Date: 2004-03-23 16:41:40
Message-ID: FHEPJNONMOLHMPDJDOCMOEPHFGAA.roba@bml.uk.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I am trying to find a way of performing something similar to the SQL-Server SQL of

IF NOT EXISTS (SELECT id FROM a_table WHERE id='akey')
THEN INSERT INTO a_table (id, name) values ('akey', 'adetails');

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.619 / Virus Database: 398 - Release Date: 10/03/2004

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Andrew Sullivan 2004-03-23 17:36:32 Re: [ADMIN] Benchmarking postgres on Solaris/Linux
Previous Message Josh Berkus 2004-03-23 16:15:39 Re: [PERFORM] Benchmarking postgres on Solaris/Linux