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: Jim Nasby <Jim.Nasby@bluetreble.com>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Daniel Verite <daniel@manitou-mail.org>
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, 02 Feb 2017 20:32:23 -0500
Message-ID: <3109.1486085543@sss.pgh.pa.us> (raw )
In-Reply-To: <CADkLM=eA+rxg+vA1q0hGqfxH0WeWsLU+7W3xtvxfMO1Rw2YLSw@mail.gmail.com >
References: <fe2e8a9c-5a08-44d6-9767-f4dabd7c4f92@manitou-mail.org >
<alpine.DEB.2.20.1701262143090.26793@lancre >
<CADkLM=cr2z935TF3eB9jByWiijv-q2B7--QggfUUB12gCFFByQ@mail.gmail.com >
<CADkLM=di=8WQRQDku6mfN=-pBqVQq_3osAARtVb6Tf0U8vyb7A@mail.gmail.com >
<alpine.DEB.2.20.1701280721020.13068@lancre >
<CADkLM=dm+d_FgtK4wqVkKr-X+naHXw60x+0veb04idFxYB141g@mail.gmail.com >
<alpine.DEB.2.20.1701290916420.13068@lancre >
<alpine.DEB.2.20.1701310658530.9372@lancre >
<CADkLM=c8M9LDBdvijq=yXrS4ar2KLoq7uoYs0JQFmh0d3w2hmg@mail.gmail.com >
<1084.1485886511@sss.pgh.pa.us >
<CADkLM=fdBs+G1QrUvqu5MxW7jGg-ULZFcM3Fd2kev6fjrp7-0g@mail.gmail.com >
<e9580abbf2d78fa6b6b4af0a4943f5ab@xs4all.nl >
<CADkLM=e1_=iSxP72MP7WOAgyrFC6emO_7yAJDGeeC4tHkYjfcQ@mail.gmail.com >
<alpine.DEB.2.20.1702011407221.31128@lancre >
<CADkLM=cBX9mb1FTymLrijmQFAoHjFZGNhphx6-V9u6jcGHzdTw@mail.gmail.com >
<alpine.DEB.2.20.1702012046410.31128@lancre >
<b52a4e15-8a6a-a3d5-0e92-76263a998829@BlueTreble.com >
<CADkLM=fxL+fg1S_oCn3DXyAZy0cBOM77sGRA! ScHsop_M2=WHJw@mail.gmail.com >
<CADkLM=eA+rxg+vA1q0hGqfxH0WeWsLU+7W3xtvxfMO1Rw2YLSw@mail.gmail.com >
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Corey Huinker <corey.huinker@gmail.com> writes:
>> As it is, I've added interactive mode psql_error notifications about the
>> resulting branching state of any branching commands, and any attempt to
>> send non-branching commands or queries while in an inactive branch will
>> generate a psql_error saying that the command was ignored. Waiting til I
>> get what should or shouldn't be done about prompts before issuing the next
>> patch revision.
On reflection, it seems fairly improbable to me that people would use
\if and friends interactively. They're certainly useful for scripting,
but would you really type commands that you know are going to be ignored?
Therefore, I don't think we should stress out about fitting branching
activity into the prompts. That's just not the use-case. (Note: we
might well have to reconsider that if we get looping, but for now it's
not a problem.) Moreover, if someone is confused because they don't
realize they're inside a failed \if, it's unlikely that a subtle change in
the prompt would help them. So your more in-the-face approach of printing
messages seems good to me.
> So far, interactive branching information will look like this (it prints on
> every branching command and on every ignored command):
This seems more or less reasonable, although:
> # \endif
> active \endif, executing commands
looks a bit weird. Maybe instead say "exited \if, executing commands"?
BTW, what is your policy about nesting these things in include files?
My immediate inclination is that if we hit EOF with open \if state,
we should drop it and revert to the state in the surrounding file.
Otherwise things will be way too confusing.
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: <3109.1486085543@sss.pgh.pa.us>
Permalink: ../3109.1486085543@sss.pgh.pa.us/
Also on: postgresql.org/message-id/3109.1486085543@sss.pgh.pa.us
copy link · copy postgr.es
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, Jim.Nasby@bluetreble.com, coelho@cri.ensmp.fr, er@xs4all.nl, daniel@manitou-mail.org, pgsql-hackers-owner@postgresql.org
Subject: Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless)
In-Reply-To: <3109.1486085543@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