Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbw5m-0000gZ-KW for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2017 21:17:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cbw5m-0002nq-0O for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2017 21:17:26 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cbw4M-0001DC-BZ; Thu, 09 Feb 2017 21:15:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cbw4J-0007yT-LS; Thu, 09 Feb 2017 21:15:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v19LFmNO005096; Thu, 9 Feb 2017 16:15:48 -0500 From: Tom Lane To: Corey Huinker cc: Robert Haas , Fabien COELHO , Daniel Verite , Erik Rijkers , Jim Nasby , PostgreSQL , pgsql-hackers-owner@postgresql.org Subject: Re: \if, \elseif, \else, \endif (was Re: PSQL commands: \quit_if, \quit_unless) In-reply-to: References: <24063.1486671184@sss.pgh.pa.us> Comments: In-reply-to Corey Huinker message dated "Thu, 09 Feb 2017 16:03:36 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5094.1486674948.1@sss.pgh.pa.us> Date: Thu, 09 Feb 2017 16:15:48 -0500 Message-ID: <5095.1486674948@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Corey Huinker writes: > On Thu, Feb 9, 2017 at 3:13 PM, Tom Lane 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