Re: checking if sequence exists

Поиск
Список
Период
Сортировка
От Elliot
Тема Re: checking if sequence exists
Дата
Msg-id 52868E61.1000806@gmail.com
обсуждение исходный текст
Ответ на Re: checking if sequence exists  (Thara Vadakkeveedu <tharagv@yahoo.com>)
Ответы Re: checking if sequence exists  (Thara Vadakkeveedu <tharagv@yahoo.com>)
Список pgsql-admin
On 2013-11-15 16:09, Thara Vadakkeveedu wrote:
"First, is this code in a plpgsql contex"?
 
No, that is my problem.
 
Does it have to be inside a Create function block or can just wrapping the if  with a BEGIN END; suffice ?
 

Control structures like if statements don't exist in straight sql - you need a procedural language like pl/pgsql for that. Wrapping sql statements in begin/end only affects the transactional context of the statements, it does not cause them to be interpreted as pl/pgsql. You can either create a function or you can use a "DO" block, which is sometimes what I use for deploy scripts [http://www.postgresql.org/docs/9.3/static/sql-do.html].

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

Предыдущее
От: Thara Vadakkeveedu
Дата:
Сообщение: Re: checking if sequence exists
Следующее
От: Thara Vadakkeveedu
Дата:
Сообщение: Re: checking if sequence exists