Re: Determine server version from psql script

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: "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 01:47:05
Message-ID: CA+FnnTz9-cjBDf3mC9fx_FCtZGDTneF9=w8LpTRdwCfxHN86yw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, Adrian,

On Sat, Mar 22, 2025, 7:42 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 3/22/25 17:31, Igor Korot wrote:
> > Hi, All,
> > I have a big script that populated the DB for me.
>
> The language used for the script?
>

What do you mean?
Its just a text file with bunch of create table/insert into

> Is it actually running in psql?
>

Yes, i run "psql - d draft -a -f <filename>

> >
> > I made it based on the latest available version.
> >
> > However, i have version 13 installed on my Linux box and so trying to
> > execute "CREATE OR REPLACE TRIGGER..." will fail.
> >
> > Is there a way to determine the server version from such a script?
>
> From here:
>
>
> https://www.postgresql.org/docs/13/runtime-config-preset.html#GUC-SERVER-VERSION-NUM
>
> show server_version_num;
>
> Though how you use that is going to depend on the answers to the first
> two questions.
>
> >
> > Thank you.
> >
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2025-03-23 01:58:50 Re: Determine server version from psql script
Previous Message Tom Lane 2025-03-23 01:12:05 Re: Nested Stored Procedures - ERROR: invalid transaction termination 2D000