Re: function expression in FROM may not refer to other relations of same query level
| От | Philippe Lang |
|---|---|
| Тема | Re: function expression in FROM may not refer to other relations of same query level |
| Дата | |
| Msg-id | 6C0CF58A187DA5479245E0830AF84F420803B4@poweredge.attiksystem.ch обсуждение исходный текст |
| Ответ на | function expression in FROM may not refer to other relations of same query level ("Philippe Lang" <philippe.lang@attiksystem.ch>) |
| Ответы |
Re: function expression in FROM may not refer to other relations of same query level
|
| Список | pgsql-sql |
I found one solution:
select id, usr, code, (get_lines(code)).line1, (get_lines(code)).line2
from tbl;
The problem now is that get_lines is being called twice per line. (I check with a RAISE NOTICE).
Philippe
-----Message d'origine-----
De : pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] De la part de Philippe Lang
Envoyé : mercredi, 11. août 2004 08:41
À : pgsql-sql@postgresql.org
Objet : Re: [SQL] function expression in FROM may not refer to other relations of same query level
Hello,
> Whats wrong with just using CASE:
>
> select id, usr, code,
> case when code = 1 then 'A' else 'Z' end as line1,
> case when code = 1 then 'A' else 'Z' end as line2 from tbl;
The code I showed in my last mail was actually test code only. The logic is more complicated, and I'm not sure it's
possibleto implement it with a SELECT... CASE. What's more, the "get_lines" function already exists, and is already
usedin different parts of the database. I would like, if possible, to use it without changing it, or duplicating code.
Philippe
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org
В списке pgsql-sql по дате отправления: