pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Daniel Verite <daniel@manitou-mail.org>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Jim Nasby <Jim.Nasby@bluetreble.com>
Cc: PostgreSQL <pgsql-hackers@postgresql.org>
Cc: pgsql-hackers-owner@postgresql.org
Subject: Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
Date: Thu, 09 Feb 2017 16:15:48 -0500
Message-ID: <5095.1486674948@sss.pgh.pa.us> (raw)
In-Reply-To: <CADkLM=ekhJnLU6UAh-piVhGY1Z=-iWkwANXM9djXBd9LyPirVg@mail.gmail.com>
References: <CADkLM=dcMHeSOQZv0Dd8AO4cM+OzADg7u8PcA7d8pNezmLDo=g@mail.gmail.com>
	<ac097a44-f9f4-4e80-ba6b-996f0e42c8d8@manitou-mail.org>
	<CADkLM=dZ=u5+iTMQY=CnEkAjmwh2f2+Pv_==V5tELcR0P7qxJw@mail.gmail.com>
	<CADkLM=cxEPJW+67cnam_on_fH3eQaekTS-8=Aa-JM+4ETr71Kw@mail.gmail.com>
	<alpine.DEB.2.20.1702050813050.21110@lancre>
	<CADkLM=d1pmBN5x+X4Hm46UHOXHSdTCVpToC6ZPEAFM7T8UYEnw@mail.gmail.com>
	<alpine.DEB.2.20.1702061014150.10745@lancre>
	<alpine.DEB.2.20.1702061038090.10745@lancre>
	<CADkLM=cB6yCZiqXam6TkT+9UDrsmyrievdOUcOWRqMiEvt3HPw@mail.gmail.com>
	<alpine.DEB.2.20.1702062030240.8133@lancre>
	<CADkLM=fYJ=1rQbj=dCoMrFkVs=+6=cfmNSD8RRSL8-UxF40-Ew@mail.gmail.com>
	<alpine.DEB.2.20.1702062104291.8133@lancre>
	<CADkLM=cnCg+rxWfL9H-zL30QusB7vr0meykhwgJAtren21rxYA@mail.gmail.com>
	<CADkLM=eVD+SXB0LD6J1pn+NiWn4sLqR7RUpMpd8FPnvyToyWjw@mail.gmail.com>
	<CA+TgmoYn+cVfS=DiL6usdDHurV8UKCJQrShCbs5o+9dXEVTqvg@mail.gmail.com>
	<24063.1486671184@sss.pgh.pa.us>
	<CADkLM=ekhJnLU6UAh-piVhGY1Z=-iWkwANXM9djXBd! 9LyPirVg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Corey Huinker <corey.huinker@gmail.com> writes:
> On Thu, Feb 9, 2017 at 3:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> IMO, an erroneous backslash command should have no effect, period.

> One way around this is to make the small change: commands with invalid
> expressions are ignored in interactive mode.

> Another way around it would be to ignore branching commands in interactive
> mode altogether and give a message like "branching commands not supported
> in interactive mode".

Uh, neither of those seem to be responding to my point.  There is no case
in psql where a command with an invalid argument does something beyond
throwing an error.  I do not think that \if is the place to start.

Having it act differently in interactive and noninteractive modes is an
even worse idea.  AFAICS, the only real value of using \if interactively
is to test out something you are about to copy into a script.  If we go
that route we're destroying the ability to test that way.

Basically, I think you need to start removing complexity (in the sense of
special cases), not adding more.  I think Robert was saying the same
thing, though possibly I shouldn't put words in his mouth.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (232+ messages)  latest in thread

Message-ID: <5095.1486674948@sss.pgh.pa.us>
Permalink:  ../5095.1486674948@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5095.1486674948@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, corey.huinker@gmail.com, robertmhaas@gmail.com, coelho@cri.ensmp.fr, daniel@manitou-mail.org, er@xs4all.nl, Jim.Nasby@bluetreble.com, pgsql-hackers-owner@postgresql.org
  Subject: Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
  In-Reply-To: <5095.1486674948@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox