Re: BUG #4516: FOUND variable does not work after RETURN QUERY

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-bugs(at)postgresql(dot)org, postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #4516: FOUND variable does not work after RETURN QUERY
Date: 2009-02-05 15:26:04
Message-ID: 200902051526.n15FQ4E21836@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Pavel Stehule wrote:
> I am sending patch, that adds FOUND and GET DIAGNOSTICS support for
> RETURN QUERY statement

Updated patch attached and applied. Thanks.

---------------------------------------------------------------------------

>
> Regards
> Pavel Stehule
>
>
>
> 2008/11/10 Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>:
> >>>>>> "Pavel" == "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
> >
> > >> Well, changing the semantics of an already-released statement
> > >> carries a risk of breaking existing apps that aren't expecting it
> > >> to change FOUND. So I'd want to see a pretty strong case why this
> > >> is important --- not just that it didn't meet someone's
> > >> didn't-read-the-manual expectation.
> >
> > Pavel> It's should do some problems, but I belive much less than
> > Pavel> change of casting or tsearch2 integration. And actually it's
> > Pavel> not ortogonal. Every not dynamic statement change FOUND
> > Pavel> variable.
> >
> > Regardless of what you think of FOUND, a more serious problem is this:
> >
> > postgres=# create function test(n integer) returns setof integer language plpgsql
> > as $f$
> > declare
> > rc bigint;
> > begin
> > return query (select i from generate_series(1,n) i);
> > get diagnostics rc = row_count;
> > raise notice 'rc = %',rc;
> > end;
> > $f$;
> > CREATE FUNCTION
> > postgres=# select test(3);
> > NOTICE: rc = 0
> > test
> > ------
> > 1
> > 2
> > 3
> > (3 rows)
> >
> > Since GET DIAGNOSTICS is documented as working for every SQL query
> > executed in the function, rather than for a specific list of
> > constructs, this is clearly a bug.
> >
> > --
> > Andrew (irc:RhodiumToad)
> >
> > --
> > Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-bugs
> >

[ Attachment, skipping... ]

>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 4.3 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Stephan Szabo 2009-02-05 15:42:44 Re: BUG #4640: Drop leading zero in EXECUTE
Previous Message Дикун Эдуард 2009-02-05 14:22:26 Re: BUG #4640: Drop leading zero in EXECUTE

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-02-05 17:05:01 Fixing Grittner's planner issues
Previous Message Robert Haas 2009-02-05 14:44:43 Re: Auto-updated fields