Re: checking if sequence exists

From: Elliot <yields(dot)falsehood(at)gmail(dot)com>
To: Thara Vadakkeveedu <tharagv(at)yahoo(dot)com>, Kevin Grittner <kgrittn(at)ymail(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: checking if sequence exists
Date: 2013-11-15 21:13:05
Message-ID: 52868E61.1000806@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 justwrapping
> 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]

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Thara Vadakkeveedu 2013-11-15 22:56:33 Re: checking if sequence exists
Previous Message Thara Vadakkeveedu 2013-11-15 21:09:23 Re: checking if sequence exists