pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Дилян Палаузов <dpa-postgres@aegee.org>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: psql history and "-- lines"
Date: Fri, 05 May 2017 21:25:23 -0400
Message-ID: <19006.1494033923@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwZ8f9smjWr97qFW+scCg+bydiKHHpEO6gs6Pq=DQxWoaA@mail.gmail.com>
References: <48b3a5ac-d219-6568-6751-260b1387bc37@aegee.org>
	<CAKFQuwZ8f9smjWr97qFW+scCg+bydiKHHpEO6gs6Pq=DQxWoaA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Fri, May 5, 2017 at 1:52 PM, Дилян Палаузов <dpa-postgres@aegee.org>
> 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 because
-- 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


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (8+ messages)  latest in thread

Message-ID: <19006.1494033923@sss.pgh.pa.us>
Permalink:  ../19006.1494033923@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19006.1494033923@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, dpa-postgres@aegee.org
  Subject: Re: psql history and "-- lines"
  In-Reply-To: <19006.1494033923@sss.pgh.pa.us>
  References: <48b3a5ac-d219-6568-6751-260b1387bc37@aegee.org> <CAKFQuwZ8f9smjWr97qFW+scCg+bydiKHHpEO6gs6Pq=DQxWoaA@mail.gmail.com> <19006.1494033923@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox