Re: RETURN QUERY generates error

From: Richard Huxton <dev(at)archonet(dot)com>
To: Yura Gal <yuragal(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: RETURN QUERY generates error
Date: 2008-03-06 08:24:51
Message-ID: 47CFAA53.7010309@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Yura Gal wrote:
>
> IF _byblocks IS TRUE THEN
> RETURN QUERY SELECT
> regexp_split_to_table(array_to_string(_sequence, ','), E',');
> ELSE
> RETURN QUERY SELECT array_to_string(_sequence, '');
> END IF;
> RETURN;
> END;
> $body$
> LANGUAGE 'plpgsql' IMMUTABLE CALLED ON NULL INPUT SECURITY INVOKER;
>
> 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. If you replace them with RETURN QUERY SELECT '' does
that make the error go away?

Oh, and are you sure you mean IMMUTABLE? That's only true if hg18.genome
is a static table.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2008-03-06 08:40:47 Re: RETURN QUERY generates error
Previous Message Richard Huxton 2008-03-06 08:13:43 Re: Bit string help, please