Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T2BQM-00028E-F6 for pgsql-bugs@postgresql.org; Fri, 17 Aug 2012 01:32:30 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T2BPy-0002Vc-78 for pgsql-bugs@postgresql.org; Fri, 17 Aug 2012 01:32:08 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1T2BPv-0006lN-2X; Thu, 16 Aug 2012 21:32:03 -0400 Date: Thu, 16 Aug 2012 21:32:03 -0400 From: Bruce Momjian To: Robert Haas Cc: Tom Lane , David Fetter , pgsql-bugs@postgresql.org Subject: Re: BUG #6067: In PL/pgsql, EXISTS(SELECT ... INTO...) fails Message-ID: <20120817013203.GO30286@momjian.us> References: <24370.1308429051@sss.pgh.pa.us> <201111300232.pAU2WgS10262@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201208/136 X-Sequence-Number: 33860 On Wed, Nov 30, 2011 at 03:36:11PM -0500, Robert Haas wrote: > On Tue, Nov 29, 2011 at 9:32 PM, Bruce Momjian wrote: > > Tom Lane wrote: > >> "David Fetter" 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 http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +