Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6oWN-0004s2-7H for pgsql-bugs@arkaria.postgresql.org; Sat, 06 May 2017 01:28:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d6oWM-0007rj-9O for pgsql-bugs@arkaria.postgresql.org; Sat, 06 May 2017 01:28:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d6oVe-0005Pc-FQ for pgsql-bugs@postgresql.org; Sat, 06 May 2017 01:27:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d6oVb-0001Ku-C3 for pgsql-bugs@postgresql.org; Sat, 06 May 2017 01:27:45 +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 v461PNY1019007; Fri, 5 May 2017 21:25:23 -0400 From: Tom Lane To: "David G. Johnston" cc: =?UTF-8?B?0JTQuNC70Y/QvSDQn9Cw0LvQsNGD0LfQvtCy?= , "pgsql-bugs@postgresql.org" Subject: Re: psql history and "-- lines" In-reply-to: References: <48b3a5ac-d219-6568-6751-260b1387bc37@aegee.org> Comments: In-reply-to "David G. Johnston" message dated "Fri, 05 May 2017 13:57:40 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <19005.1494033923.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 05 May 2017 21:25:23 -0400 Message-ID: <19006.1494033923@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-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org "David G. Johnston" writes: > On Fri, May 5, 2017 at 1:52 PM, =D0=94=D0=B8=D0=BB=D1=8F=D0=BD =D0=9F=D0= =B0=D0=BB=D0=B0=D1=83=D0=B7=D0=BE=D0=B2 > wrote: >> Could you plexe alter psql, so that it logs two lines in the history for >> the mentioned case? > It probably should only behave as you suggest in --single-line mode... I'm not exactly convinced that the proposed change would be an improvement. Consider code along the lines of (actual example from system_views.sql): -- -- Redeclare built-in functions that need default values attached to their -- arguments. It's impractical to set those up directly in pg_proc.h becau= se -- of the complexity and platform-dependency of the expression tree -- representation. (Note that internal functions still have to have entries -- in pg_proc.h; we are merely causing their proargnames and proargdefaults -- to get filled in.) -- CREATE OR REPLACE FUNCTION pg_start_backup(label text, fast boolean DEFAULT false, exclusive boolean= DEFAULT true) RETURNS pg_lsn STRICT VOLATILE LANGUAGE internal AS 'pg_start_backup' PARALLEL RESTRICTED; Would you really want each of those -- lines to be their own history entry? Another angle to think about is /* ... */ comments, which you really can't break into separate lines without creating a syntactically-invalid mess. That type of comment also creates the possibility of input like /* foo * bar */ select ... There isn't any very nice way to separate this comment from the SQL query for history purposes. In my own usage, I think having leading comments being treated as part of the SQL command is a good thing --- they're sort of a unit, in most cases. regards, tom lane --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs