Richard Huxton <dev@archonet.com> writes:
> Yura Gal wrote:
>> all is fine until the last IF. Both RETURN QUERY blocks generate
>> error: 'syntax error at or near SELECT ...' I feel that something
>> wrong with casting _sequence var but I can't figure out the exact
>> point.
> Can't think why it's not happy - if I create an empty table to go with
> it, it runs here.
The error sounds suspiciously like what would happen if you tried to
use RETURN QUERY in a pre-8.3 version.
regards, tom lane