Re: Running CREATE only on certain Postgres versions

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: David Johnston <polobo(at)yahoo(dot)com>, Robert James <srobertjames(at)gmail(dot)com>, Igor Neyman <ineyman(at)perceptron(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Running CREATE only on certain Postgres versions
Date: 2012-09-26 14:23:36
Message-ID: 50630FE8.3010900@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 09/25/2012 08:25 AM, Daniele Varrazzo wrote:
> On Tue, Sep 25, 2012 at 3:47 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> wrote:
>
>> To elaborate:
>> test=> SELECT current_setting('server_version_num');
>> current_setting
>> -----------------
>> 90009
>
> Yes, but knowing that, how does he run a statement only if version
> e.g. >= 80400? Is there a better way than the proposed
> create/call/drop function before PG 9.0? (since 9.0 there is the DO
> statement).

From the OP:
"I have some code which creates a function in Postgres.."

It is unclear what that code is in its entirety. If it is straight SQL
than I see no other choice than the above create/call/drop. If it is
some other language over SQL then I could see an IF statement or its
equivalent.

>
> -- Daniele
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Blackwell 2012-09-26 14:33:06 Re: unique constraint with significant nulls?
Previous Message salah jubeh 2012-09-26 14:21:57 estemated number of rows and optimiser effeciency