From: | Cal Heldenbrand <cal(at)fbsdata(dot)com> |
---|---|
To: | Francisco Olarte <folarte(at)peoplecall(dot)com> |
Cc: | Achilleas Mantzios <achill(at)matrix(dot)gatewaynet(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: psql color hostname prompt |
Date: | 2016-04-26 15:20:48 |
Message-ID: | CAAcwKheywkdMgGeU=gczDGxxc3b3U2hUik7i2ShkjGF2=rK4=Q@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks for the input everyone. I'll try to comment on each discussion
point:
1) garbled output in large queries
I messed around with a few things, and have not been able to recreate any
issues. Can you provide a test case for this? Also, any other interesting
things about your terminal, like your $TERM setting, locale, etc. (I'm
using xterm with UTF-8, and KDE's Konsole app)
2) %M vs shell call
%M on when connected to the local machine displays the string "[local]"
which I didn't like. I wanted a real hostname to show no matter which
client/server pair I was using. Zero chance for mistaken commands on the
wrong host. Many times we ssh to a remote server, then run psql locally.
Perhaps the more elegant route here, is to change psql's behavior with %M
when connected to the local machine? (This would also solve point #3)
3) a forked process for every prompt
While this also isn't very elegant, it seems to work fine. It's not
something to worry about these days when the server has 40 cores. ;-)
But, I've noticed that different distros store lsof in different locations,
so per-environment tweaking might be necessary.
It would be nice if there was a way to do some kind of templating script
with the psqlrc file. Something that would dynamically generate the "\set
PROMPT" commands on psql startup, rather than calling out to a shell every
command. (I'm thinking along the lines of ERB for Ruby, Django for Python,
etc.)
But again, I think the more elegant approach is to alter the %M logic.
Any thoughts?
Thanks!
--Cal
<cal(at)fbsdata(dot)com>
On Mon, Apr 25, 2016 at 9:39 AM, Francisco Olarte <folarte(at)peoplecall(dot)com>
wrote:
> Hi:
>
> On Mon, Apr 25, 2016 at 4:04 PM, Achilleas Mantzios
> <achill(at)matrix(dot)gatewaynet(dot)com> wrote:
> > Hello, have done that, looked really nice, but unfortunately this
> resulted
> > in a lot of garbled output, in case of editing functions, huge queries,
> up
> > arrows, etc...
>
> Did you use %[ %] to delimit non-printing sequences as Cal did? I've
> tested his prompt ( substituting 'echo tarari' for his sh script ) and
> it works fine ( at least in xfce4-terminal / ubuntu / 6 terminal lines
> long input line ). I've seen a lot of color prompts worked by
> forgetting them ( even when the doc for them specially speaks of color
> changes ).
> Frnacisco Olarte.
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Crawford | 2016-04-26 16:02:49 | Re: psql color hostname prompt |
Previous Message | Pavel Stehule | 2016-04-26 14:27:41 | Re: Problems running the WorkerSpi sample |