Re: BUG #6067: In PL/pgsql, EXISTS(SELECT ... INTO...) fails

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <dfetter(at)vmware(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6067: In PL/pgsql, EXISTS(SELECT ... INTO...) fails
Date: 2012-08-17 01:32:03
Message-ID: 20120817013203.GO30286@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Nov 30, 2011 at 03:36:11PM -0500, Robert Haas wrote:
> On Tue, Nov 29, 2011 at 9:32 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Tom Lane wrote:
> >> "David Fetter" <dfetter(at)vmware(dot)com> writes:
> >> >     IF EXISTS (SELECT 1 INTO STRICT i) THEN
> >> >         RAISE NOTICE '%', a;
> >> >     END IF;
> >>
> >> Umm ... are you just complaining that the error message isn't very
> >> helpful, or are you actually expecting that to do something useful?
> >> If the latter, what exactly?  I'm particularly confused by your use
> >> of the STRICT option here, because if we did support that, I would
> >> expect the STRICT to throw an error if there were not exactly one
> >> matching row, making the EXISTS test 100% pointless.
> >>
> >> But the short answer is that we don't support INTO in sub-selects,
> >> and in general I doubt that we ever will, since in most cases the
> >> behavior wouldn't be very well-defined.  It might be worth a TODO
> >> to provide a better error message than "syntax error", though.
> >
> > Is it worth documenting, fixing, or adding this to the TODO list?
>
> At most I would say we could try to improve the error message.

I researched this and it seems to complex to improve the error message.
I am afraid it would have to bleed into the main backend parser.

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

+ It's impossible for everything to be true. +

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2012-08-17 07:31:42 Re: BUG #7494: WAL replay speed depends heavily on the shared_buffers size
Previous Message Bruce Momjian 2012-08-17 00:34:01 Re: Cannot dump 8.4.8 database using later versions