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 6C0CF58A187DA5479245E0830AF84F420803B3@poweredge.attiksystem.ch
обсуждение исходный текст
Ответ на function expression in FROM may not refer to other relations of same query level  ("Philippe Lang" <philippe.lang@attiksystem.ch>)
Список pgsql-sql
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 possible to implement it with
a SELECT... CASE. What's more, the "get_lines" function already exists,
and is already used in different parts of the database. I would like, if
possible, to use it without changing it, or duplicating code.

Philippe


В списке pgsql-sql по дате отправления:

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: Wierded error in recursive function; debugging ideas?
Следующее
От: "Philippe Lang"
Дата:
Сообщение: Re: function expression in FROM may not refer to other relations of same query level