Re: Using UNION inside a cursor - Mailing list pgsql-sql

From Tom Lane
Subject Re: Using UNION inside a cursor
Date
Msg-id 28146.1067527227@sss.pgh.pa.us
Whole thread Raw
In response to Re: Using UNION inside a cursor  (Christoph Haller <ch@rodos.fzk.de>)
List pgsql-sql
Christoph Haller <ch@rodos.fzk.de> 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


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Bug in Rule+Foreing key constrain?
Next
From: Jan Wieck
Date:
Subject: Re: strange postgresql failure