pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: aburacze@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6551: PL/pgSQL: GET DIAGNOSTICS not working for first OUT parameter
Date: Thu, 22 Mar 2012 13:57:02 -0400
Message-ID: <10777.1332439022@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SAlxY-0008UU-A4@wrigleys.postgresql.org>
References: <E1SAlxY-0008UU-A4@wrigleys.postgresql.org>

aburacze@gmail.com writes:
> I have just found strange behaviour of PL/pgSQL in case of using OUT
> parameters and GET DIAGNOSTICS var = ROW_COUNT (PostgreSQL 9.1.3). Here is a
> self-contained example:

Wow, that's been broken since the beginning, apparently.  There's an
entirely bogus test in exec_stmt_getdiag():

		if (diag_item->target <= 0)
			continue;

It's not clear what the point of this is, since there is no case in
which the target variable should be invalid, but in any case the effect
is to ignore attempts to assign to any variable with dno zero --- which
will be the one first defined in the function, eg the first parameter
if any.  I guess I can see how this escaped detection for a long time,
but it's broken for sure.  Thanks for the report!

			regards, tom lane



view thread (4+ messages)  latest in thread

Message-ID: <10777.1332439022@sss.pgh.pa.us>
Permalink:  ../10777.1332439022@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10777.1332439022@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, aburacze@gmail.com
  Subject: Re: BUG #6551: PL/pgSQL: GET DIAGNOSTICS not working for first OUT parameter
  In-Reply-To: <10777.1332439022@sss.pgh.pa.us>
  References: <E1SAlxY-0008UU-A4@wrigleys.postgresql.org> <10777.1332439022@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