Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cbv74-0006WH-Bp for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2017 20:14:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cbv73-0007Ss-IB for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Feb 2017 20:14:41 +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 1cbv5e-0005u6-Fb; Thu, 09 Feb 2017 20:13:14 +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 1cbv5b-0006b5-Jq; Thu, 09 Feb 2017 20:13:13 +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 v19KD4TQ024064; Thu, 9 Feb 2017 15:13:04 -0500 From: Tom Lane To: Robert Haas cc: Corey Huinker , 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: Comments: In-reply-to Robert Haas message dated "Thu, 09 Feb 2017 14:58:09 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24062.1486671184.1@sss.pgh.pa.us> Date: Thu, 09 Feb 2017 15:13:04 -0500 Message-ID: <24063.1486671184@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 Robert Haas writes: > I (still) think this is a bad design. Even if you've got all the > messages just right as things stand today, some new feature that comes > along in the future can change things so that they're not right any > more, and nobody's going to relish maintaining this. FWIW, I tend to agree that this is way overboard in terms of the amount of complexity going into the messages. Also, I do not like what seems to be happening here: >> $ psql test < test2.sql -v ON_ERROR_STOP=0 >> unrecognized value "error" for "\if ": boolean expected >> new \if is invalid, ignoring commands until next \endif IMO, an erroneous backslash command should have no effect, period. "It failed but we'll treat it as if it were valid" is a rathole I don't want to descend into. It's particularly bad in interactive mode, because the most natural thing to do is correct your spelling and issue the command again --- but if psql already decided to do something on the strength of the mistaken command, that doesn't work, and you'll have to do something or other to unwind the unwanted control state before you can get back to what you meant to do. 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