proposal: condition blocks in psql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: condition blocks in psql
Date: 2015-06-28 03:59:25
Message-ID: CAFj8pRA9HYo8stKNogPHMZ6_a6Ug+k5+94p=EpgvPBNFdQamhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2015-06-28 05:49:15 Re: proposal: condition blocks in psql
Previous Message Amit Kapila 2015-06-28 03:55:30 Re: Semantics of pg_file_settings view