Re: function expression in FROM may not refer to other relations of same query level

From: "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: function expression in FROM may not refer to other relations of same query level
Date: 2004-08-12 07:35:01
Message-ID: 6C0CF58A187DA5479245E0830AF84F420803B7@poweredge.attiksystem.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> > The problem now is that get_lines is being called twice per line.
>
> Is get_lines() defined as IMMUTABLE? Should it be?

I have tried defining get_lines as "IMMUTABLE", or "WITH (iscachable)",
but it keeps on getting called twice per line in the following query...

select
id,
usr,
code,
(get_lines(code)).line1,
(get_lines(code)).line2
from tbl;

I wish there was a way to run the query like this:

select
id,
usr,
code,
CAST(get_lines(code) as lines)
from tbl;

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Theo Galanakis 2004-08-12 07:58:35 Inserting into point[] type.
Previous Message Bruno Wolff III 2004-08-12 02:27:15 Re: UPDATE FROM problem, multiple updates of same row don't seem to work