Re: Determine server version from psql script

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Determine server version from psql script
Date: 2025-03-23 02:28:14
Message-ID: CA+FnnTy2Lk+K8t2uKwc1cAnCm6+RTb72eVRxt9+Y8y+C=sUeyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, David,

On Sat, Mar 22, 2025, 8:58 PM David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> On Saturday, March 22, 2025, Igor Korot <ikorot01(at)gmail(dot)com> wrote:
>
>>
>>
>>> Is it actually running in psql?
>>>
>>
>> Yes, i run "psql - d draft -a -f <filename>
>>
>
> Then read the psql docs. Your version has \if and you’ll find server
> version listed as the available client variables.
>

I was hoping for something like

If server_version >= X:
CREATE OR REPLACE TRIGGER...
else:
CREATE TRIGGER...

Python-like syntax here as I'm not sure how to do it properly...

Thank you.

> David J.
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2025-03-23 03:01:41 Re: Determine server version from psql script
Previous Message David G. Johnston 2025-03-23 01:58:50 Re: Determine server version from psql script