Re: RETURN QUERY generates error - Mailing list pgsql-sql

From Richard Huxton
Subject Re: RETURN QUERY generates error
Date
Msg-id 47CFAA53.7010309@archonet.com
Whole thread Raw
In response to RETURN QUERY generates error  ("Yura Gal" <yuragal@gmail.com>)
Responses Re: RETURN QUERY generates error  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re: Bit string help, please
Next
From: "Pavel Stehule"
Date:
Subject: Re: RETURN QUERY generates error