pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sim Zacks <sim@compulab.co.il>
To: pgsql-general@postgresql.org
Subject: Re: conditional insert
Date: Mon, 05 Sep 2011 13:28:20 +0300
Message-ID: <4E64A444.5070604@compulab.co.il> (raw)
In-Reply-To: <CADFuJLjCF6fmxswgS033EFyofmbJFy+J0ToUvwTCDDLYj+nr3Q@mail.gmail.com>
References: <CADFuJLjCF6fmxswgS033EFyofmbJFy+J0ToUvwTCDDLYj+nr3Q@mail.gmail.com>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <style>body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
  </head>
  <body style="direction: ltr;"
    bidimailui-detected-decoding-type="latin-charset" bgcolor="#ffffff"
    text="#000000">
    On 09/05/2011 12:38 PM, Pau Marc Mu&ntilde;oz Torres wrote:
    <blockquote
cite="mid:CADFuJLjCF6fmxswgS033EFyofmbJFy+J0ToUvwTCDDLYj+nr3Q@mail.gmail.com"
      type="cite">Hi follk<br>
      <br>
      &nbsp;i trying&nbsp; to performe a&nbsp; conditional insert into a table, indeed,
      what i'm trying to do is not insert a record into the table if
      that record exist<br>
      <br>
      googleling i found something like<br>
      <br>
      &nbsp;insert into XX values (1,2,3) where not exist (select ....);<br>
      <br>
      but i'm having and error near where...<br>
      <br>
      anyone knows how do i can perfome this insert?<br>
      <br>
      thanks<br>
      <br>
      p<br>
    </blockquote>
    <p>You can either do an Insert(...) select... from...where...</p>
    <p>or you can add a rule to the table that checks if the key exists
      and if so, do an update or nothing instead.<br>
    </p>
  </body>
</html>



view thread (36+ messages)  latest in thread

Message-ID: <4E64A444.5070604@compulab.co.il>
Permalink:  ../4E64A444.5070604@compulab.co.il/
Also on:    postgresql.org/message-id/4E64A444.5070604@compulab.co.il

 · 

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: sim@compulab.co.il
  Subject: Re: conditional insert
  In-Reply-To: <4E64A444.5070604@compulab.co.il>
  References: <CADFuJLjCF6fmxswgS033EFyofmbJFy+J0ToUvwTCDDLYj+nr3Q@mail.gmail.com> <4E64A444.5070604@compulab.co.il>

* 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