proposal: condition blocks in psql - Mailing list pgsql-hackers

From Pavel Stehule
Subject proposal: condition blocks in psql
Date
Msg-id CAFj8pRA9HYo8stKNogPHMZ6_a6Ug+k5+94p=EpgvPBNFdQamhA@mail.gmail.com
Whole thread Raw
Responses Re: proposal: condition blocks in psql  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: proposal: condition blocks in psql  (Corey Huinker <corey.huinker@gmail.com>)
List pgsql-hackers
Hi

I am thinking about simplifying a deployment some multiversion PostgreSQL extensions, and scripts.

With current possibilities, we have to use DO statement, what is not optimal or possible in some use cases. The implementation of condition block (possible nested) is very simple.

The proposed syntax of new psql commands

\if_ver_eq 9.2
 ...
\else
\endif

\if_ver_gt 9.2
\if_ver_ge 9.2
\if_ver_le 9.2
\if_ver_lt 9.2

minor versions can be supported too

\if_ver_ge 9.2.0
\endif

\if_def psqlvariable
\if_eq psqlvariable
\if_ne psqlvariable 

What do you thinking about it?

Regards

Pavel

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Semantics of pg_file_settings view
Next
From: Fabien COELHO
Date:
Subject: Re: proposal: condition blocks in psql