Re: [BUGS] BUG #4516: FOUND variable does not work after RETURN QUERY - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [BUGS] BUG #4516: FOUND variable does not work after RETURN QUERY
Date
Msg-id 200901092254.n09MssY25608@momjian.us
Whole thread Raw
In response to Re: [BUGS] BUG #4516: FOUND variable does not work after RETURN QUERY  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Responses Re: [BUGS] BUG #4516: FOUND variable does not work after RETURN QUERY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Uh, is this ready to be applied?

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

Pavel Stehule wrote:
> I am sending patch, that adds FOUND and GET DIAGNOSTICS support for
> RETURN QUERY statement
> 
> Regards
> Pavel Stehule
> 
> 
> 
> 2008/11/10 Andrew Gierth <andrew@tao11.riddles.org.uk>:
> >>>>>> "Pavel" == "Pavel Stehule" <pavel.stehule@gmail.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@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-bugs
> >

[ Attachment, skipping... ]

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

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: 2 small patches that fix 8.3.5 compile issues on Vista+MingW+Msys
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #4516: FOUND variable does not work after RETURN QUERY