Re: bug with if ... then ... clause in views

Поиск
Список
Период
Сортировка
От Jeff
Тема Re: bug with if ... then ... clause in views
Дата
Msg-id 43CE61B6.8010704@torgo.978.org
обсуждение исходный текст
Ответ на bug with if ... then ... clause in views  (Emil Rachovsky <zsevgymko@yahoo.com>)
Список pgsql-general
Emil Rachovsky wrote:

>While trying to create some views I stumbled on some
>problem with using the if-then clause. Here is a
>simple example :
>
>CREATE OR REPLACE VIEW public.SomeView
>  as select d.id,
>  if (true) then d.DocNumber endif from
>public.Z_Documents as d;
>
>I get the following error :
> syntax error at or near "then" at character 72
>
>I don't have a clue what is going on here. Any
>suggestions?
>
>
>
IF / THEN is not part of SQL. it is part of plpgsql.
However you'll find that CASE can do the same thing.
select d.id, case when true then d.docNumber else 'something else' end
as blah, public.Z_documents as d ...

--
Jeff Trout <jeff@jefftrout.com>
http://www.jefftrout.com/
http://www.stuarthamm.net/


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: "REFERENCES" and UNIQUE
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Huge number of disk writes after migration to 8.1