Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1covfV-0003Ps-LI for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Mar 2017 17:28:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1covfU-0007Ed-Tw for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Mar 2017 17:28:00 +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 1covfT-0007D0-Cr; Fri, 17 Mar 2017 17:27:59 +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 1covfR-0001DF-CX; Fri, 17 Mar 2017 17:27:58 +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 v2HHRn3R015542; Fri, 17 Mar 2017 13:27:49 -0400 From: Tom Lane To: Corey Huinker cc: Fabien COELHO , Daniel Verite , "David G. Johnston" , Greg Stark , Erik Rijkers , Robert Haas , 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: <15875.1489440118@sss.pgh.pa.us> <24741.1489698878@sss.pgh.pa.us> <30537.1489761433@sss.pgh.pa.us> <11743.1489765330@sss.pgh.pa.us> <13603.1489768437@sss.pgh.pa.us> Comments: In-reply-to Corey Huinker message dated "Fri, 17 Mar 2017 12:56:00 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15540.1489771669.1@sss.pgh.pa.us> Date: Fri, 17 Mar 2017 13:27:49 -0400 Message-ID: <15541.1489771669@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: >> In the end, I suspect that teaching all the backslash commands to do >> nothing after absorbing their arguments is likely to be the least messy >> way to tackle this, even if it makes for a rather bulky patch. > Perhaps, but just glancing at \connect makes me think that for some > commands (present or future) the number of args might depend on the value > of the first arg, and variable expansion-or-not, backtick execution-or-not > could alter the number of apparent args on the line, like this: > \set x 'arg1 arg2' > \if false > \cmd_that_takes_exactly_two_args :x > \endif Yeah, throwing errors for bad arguments would also need to be suppressed. 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