Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coupP-0008WS-Ap for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Mar 2017 16:34:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1coupO-0002gS-SN for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Mar 2017 16:34:10 +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 1coupM-0002YS-H2; Fri, 17 Mar 2017 16:34:08 +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 1coupK-00008s-FB; Fri, 17 Mar 2017 16:34:07 +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 v2HGXvgR013604; Fri, 17 Mar 2017 12:33:57 -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> Comments: In-reply-to Corey Huinker message dated "Fri, 17 Mar 2017 12:03:01 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13602.1489768437.1@sss.pgh.pa.us> Date: Fri, 17 Mar 2017 12:33:57 -0400 Message-ID: <13603.1489768437@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: > I think Fabien was arguing that inside a false block there would be no > syntax rules beyond "is the first non-space character on this line a '\' > and if so is it followed with a if/elif/else/endif?". If the answer is no, > skip the line. To me that seems somewhat similar to Tom's suggestion that a > false branch just keeps consuming text until it encounters a \conditional > or EOF. Hmm. If we can keep the syntax requirements down to "\if and friends must be the first backslash command on the line", and not change the apparent behavior for any other command type, it probably would be okay from the user's standpoint. I'm not really convinced that this approach will accomplish that, though, and especially not that it will do so without injecting some ugliness into the core lexer. 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. 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