pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Phil Sorber <phil@omniti.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Example in plpgsql docs can lead to infinite loop
Date: Sat, 28 Jan 2012 21:08:26 -0500
Message-ID: <11808.1327802906@sss.pgh.pa.us> (raw)
In-Reply-To: <CADAkt-g8FA4kfqMpmWix+6sPQ5vWz2U0CBCUKHfN=wS3o0R3uQ@mail.gmail.com>
References: <CADAkt-g8FA4kfqMpmWix+6sPQ5vWz2U0CBCUKHfN=wS3o0R3uQ@mail.gmail.com>

Phil Sorber <phil@omniti.com> writes:
> http://www.postgresql.org/docs/devel/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE
> This example can lead to an infinite loop if there is another column
> that has a unique key constraint on it in addition to the primary key
> and someone tries to execute the function with a unique primary key
> but a duplicate value for the column with the unique constraint.

Hmm.  It might work, depending on what the table's various unique
indexes are for, but I agree that a caution about the case is
reasonable.  I adjusted your text a bit and committed this.

			regards, tom lane



view thread (2+ messages)

Message-ID: <11808.1327802906@sss.pgh.pa.us>
Permalink:  ../11808.1327802906@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11808.1327802906@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, phil@omniti.com
  Subject: Re: Example in plpgsql docs can lead to infinite loop
  In-Reply-To: <11808.1327802906@sss.pgh.pa.us>
  References: <CADAkt-g8FA4kfqMpmWix+6sPQ5vWz2U0CBCUKHfN=wS3o0R3uQ@mail.gmail.com> <11808.1327802906@sss.pgh.pa.us>

* 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