pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Corey Huinker <corey.huinker@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Greg Stark <stark@mit.edu>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Daniel Verite <daniel@manitou-mail.org>
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: Wed, 22 Feb 2017 18:15:01 -0500
Message-ID: <CADkLM=dqO2G9yLtDB9PdJqyySau+EYFS1ypK5SSthya7yLEg2w@mail.gmail.com> (raw)
In-Reply-To: <21888.1487804399@sss.pgh.pa.us>
References: <CADkLM=dcMHeSOQZv0Dd8AO4cM+OzADg7u8PcA7d8pNezmLDo=g@mail.gmail.com>
	<24063.1486671184@sss.pgh.pa.us>
	<5095.1486674948@sss.pgh.pa.us>
	<4fb8635d88c7dc907d069e15fdd1ab94@xs4all.nl>
	<CADkLM=fbsnkWUWOKz8JiU5hN-8mKDm7MgsuAq6pHk-22eqJ3xA@mail.gmail.com>
	<alpine.DEB.2.20.1702100847180.27011@lancre>
	<CADkLM=dXgQTRDsyjCUZCh9LGKbNAnxM2weVq9uO4E7LfJg5P2Q@mail.gmail.com>
	<alpine.DEB.2.20.1702102217390.26448@lancre>
	<CAM-w4HMRumvzES_PaBD8b84b_LdhTyH__FAK6xwFBgwkTzvOsw@mail.gmail.com>
	<CADkLM=f4cDjWgq_JxMhf_NS0PG-xYuL5rhVpxth2zYxpu_fMhQ@mail.gmail.com>
	<CAM-w4HNhWn=suYQfhPOHyrg4_ub1OtT+oogfRNPnacWEBa6Ugw@mail.gmail.com>
	<alpine.DEB.2.20.1702120823010.26448@lancre>
	<CADkLM=fj9EOqCB89nJ7Qm9OKdrF9xL0qqaRq3VFa5=vO4faUzg@mail.gmail.com>
	<CADkLM=dZJ77XF=0pZMeQQkLYgHyXPs=bAg4+K0W+d-U5SbwAeg@mail.gmail.com>
	<CADkLM=decErx7iFyzxuPMQ5DNd6dearn+VuE1ajWKA_NaaMtug@mail.gmail.com>
	<28640.1487108678@sss.pgh.pa.us>
	<alpine.DEB.2.20.1702142349280.16120@lancre>
	<16856.1487797250@sss.pgh.pa.us>
	<CADkLM=cxaB-GjPScrhSqcTfwEHD5JLtOOQ6PRqv8dWBY1q0c0Q@mail.gmail.com>
	<18672.1487799954@sss.pgh.pa.us>
	<CADkLM=c0h5V+H9aLOjEmc=6naRS2+W6ajZtENy+b3JpkOHZJ+w@mail.gmail.com>
	<CADkLM=c=8i8sB9Ua2fxWxWdDsgAT87Xo+X1s+R7iAtk2fdXABA@mail.gmail.com>
	<21888.1487804399@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Wed, Feb 22, 2017 at 5:59 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Ah, I see why *that* wants to know about it ... I think.  I suppose you're
> arguing that variable expansion shouldn't be able to insert, say, an \else
> in a non-active branch?  Maybe, but if it can insert an \else in an active
> branch, then why not non-active too?  Seems a bit inconsistent.
>

The major reason was avoiding situations like what Daniel showed: where
value of a variable that is meaningless/undefined in the current
false-block context gets expanded anyway, and thus code inside a false
block has effects outside of that block. Granted, his example was
contrived. I'm open to removing that feature and seeing what breaks in the
test cases.

view thread (232+ messages)  latest in thread

Message-ID: <CADkLM=dqO2G9yLtDB9PdJqyySau+EYFS1ypK5SSthya7yLEg2w@mail.gmail.com>
Permalink:  ../CADkLM=dqO2G9yLtDB9PdJqyySau+EYFS1ypK5SSthya7yLEg2w@mail.gmail.com/
Also on:    postgresql.org/message-id/CADkLM=dqO2G9yLtDB9PdJqyySau+EYFS1ypK5SSthya7yLEg2w@mail.gmail.com

 · 

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: corey.huinker@gmail.com, tgl@sss.pgh.pa.us, coelho@cri.ensmp.fr, stark@mit.edu, er@xs4all.nl, robertmhaas@gmail.com, daniel@manitou-mail.org, 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: <CADkLM=dqO2G9yLtDB9PdJqyySau+EYFS1ypK5SSthya7yLEg2w@mail.gmail.com>

* 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