Re: Example in plpgsql docs can lead to infinite loop

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Phil Sorber <phil(at)omniti(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Example in plpgsql docs can lead to infinite loop
Date: 2012-01-29 02:08:26
Message-ID: 11808.1327802906@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Phil Sorber <phil(at)omniti(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Page 2012-01-29 10:02:17 Re: Windows x86-64 One-Click Install (9.1.2-1, 9.0.6-1) hangs on "initialising the database cluster" (with work-around)
Previous Message Tom Lane 2012-01-29 01:56:42 Re: Documentation bug regarding collations