X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 16627D1B544 for ; Thu, 30 Oct 2003 15:21:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 69634-10 for ; Thu, 30 Oct 2003 11:20:59 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 735A2D1B51A for ; Thu, 30 Oct 2003 11:20:39 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h9UFKRit028147; Thu, 30 Oct 2003 10:20:28 -0500 (EST) To: Christoph Haller Cc: sgnerd@yahoo.com.sg ("Kumar"), pgsql-sql@postgresql.org Subject: Re: Using UNION inside a cursor In-reply-to: <200310300926.KAA04661@rodos> References: <200310300926.KAA04661@rodos> Comments: In-reply-to Christoph Haller message dated "Thu, 30 Oct 2003 10:26:17 +0700" Date: Thu, 30 Oct 2003 10:20:27 -0500 Message-ID: <28146.1067527227@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/402 X-Sequence-Number: 15802 Christoph Haller writes: >> OPEN ref FOR >> (SELECT * FROM history WHERE obs_type =3D \'AA\' ) >> UNION >> (SELECT * FROM history WHERE obs_type =3D \'TA\'); > My suspicion is the plpgsql parser doesn't accept the opening > parenthesis. Yeah. Looking at the plpgsql grammar, it expects the token after FOR to be either SELECT or EXECUTE. This example demonstrates that that code is wrong, so I'll fix it for 7.4. But in the meantime, why don't you just leave out the parentheses? regards, tom lane