Re: Using UNION inside a cursor

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>
Cc: sgnerd(at)yahoo(dot)com(dot)sg ("Kumar"), pgsql-sql(at)postgresql(dot)org
Subject: Re: Using UNION inside a cursor
Date: 2003-10-30 15:20:27
Message-ID: 28146.1067527227@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Christoph Haller <ch(at)rodos(dot)fzk(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message sad 2003-10-30 16:12:36 varlena versus null-terminated strings
Previous Message Stephan Szabo 2003-10-30 15:04:39 Re: Bug in Rule+Foreing key constrain?