pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-general@postgresql.org
Subject: Re: conditional insert
Date: Mon, 5 Sep 2011 12:45:13 +0300
Message-ID: <201109051245.13591.achill@matrix.gatewaynet.com> (raw)
In-Reply-To: <CADFuJLjCF6fmxswgS033EFyofmbJFy+J0ToUvwTCDDLYj+nr3Q@mail.gmail.com>
References: <CADFuJLjCF6fmxswgS033EFyofmbJFy+J0ToUvwTCDDLYj+nr3Q@mail.gmail.com>

Στις Monday 05 September 2011 12:38:34 ο/η Pau Marc Muñoz Torres έγραψε:
> Hi follk
> 
>  i trying  to performe a  conditional insert into a table, indeed, what i'm
> trying to do is not insert a record into the table if that record exist
> 

thats why primary/unique keys are for.

isolate the columns which you consider to be a correct unique key
and create a unique key on them.

thereis no notion of conditional insert that i know of.

> googleling i found something like
> 
>  insert into XX values (1,2,3) where not exist (select ....);
> 
> but i'm having and error near where...
> 
> anyone knows how do i can perfome this insert?
> 
> thanks
> 
> p
> 



-- 
Achilleas Mantzios



view thread (36+ messages)  latest in thread

Message-ID: <201109051245.13591.achill@matrix.gatewaynet.com>
Permalink:  ../201109051245.13591.achill@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/201109051245.13591.achill@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: achill@matrix.gatewaynet.com
  Subject: Re: conditional insert
  In-Reply-To: <201109051245.13591.achill@matrix.gatewaynet.com>
  References: <CADFuJLjCF6fmxswgS033EFyofmbJFy+J0ToUvwTCDDLYj+nr3Q@mail.gmail.com> <201109051245.13591.achill@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox