Search Postgresql Archives

Re: pasting a lot of commands to psql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alvaro Herrera <alvherre@xxxxxxxxxxxxxxx> writes:
> Tom Lane wrote:
>> You might have better luck with "psql -n", or maybe not.

> I've wished sometimes for a "\set READLINE off" psql metacommand for
> this kind of thing.  It's pretty annoying when the text being pasted
> contains tabs and readline uses to do completion.

Seems like the readline aspect of that wouldn't be too hard.  The fun
part would be agreeing on how we want history to behave if you flip
this on/off during a session.  Which lines get added to history?
Does ~/.psql_history get written at all if READLINE is off at the
end of the session?

A spec that seems reasonable and probably not too hard to implement is:

1. ~/.psql_history is read the first time you turn on READLINE during
a session.

2. Input lines are added to history only when READLINE is on.

3. ~/.psql_history is written at session exit if any lines have been
added to history during the session (regardless of whether READLINE
is currently on).

People might complain about point 2, but I think it would be rather
difficult to do otherwise, seeing that the active history storage
is mostly under libreadline's control.  Also, other definitions might
lead to retaining a history buffer even in totally non-interactive
sessions (where READLINE never gets turned on).  That doesn't sound
like what we'd want.

Another definitional issue is whether turning on READLINE does anything
if stdin is not a tty.  I'd vote no.

			regards, tom lane


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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux