pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to get connection details from psql -> \e
5+ messages / 3 participants
[nested] [flat]
* How to get connection details from psql -> \e
@ 2018-08-13 10:44 hubert depesz lubaczewski <depesz@depesz.com>
0 siblings, 2 replies; 5+ messages in thread
From: hubert depesz lubaczewski @ 2018-08-13 10:44 UTC (permalink / raw)
To: pgsql-general
Hi,
I'm trying to work on some extension to vim when invoked as \e from
psql.
To make it fully work, I need to know connection details that psql was
using while it invoked \e.
Is it possible to do in any way, or if not, any chance it could be added
to wishlist for next versions of Pg?
Best regards,
depesz
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to get connection details from psql -> \e
@ 2018-08-13 13:32 Laurenz Albe <laurenz.albe@cybertec.at>
parent: hubert depesz lubaczewski <depesz@depesz.com>
1 sibling, 1 reply; 5+ messages in thread
From: Laurenz Albe @ 2018-08-13 13:32 UTC (permalink / raw)
To: depesz@depesz.com; pgsql-general
hubert depesz lubaczewski wrote:
> I'm trying to work on some extension to vim when invoked as \e from
> psql.
>
> To make it fully work, I need to know connection details that psql was
> using while it invoked \e.
>
> Is it possible to do in any way, or if not, any chance it could be added
> to wishlist for next versions of Pg?
Do you mean something like \set?
test=> \set
DBNAME = 'test'
ENCODING = 'UTF8'
HOST = '/var/run/postgresql'
PORT = '5432'
SERVER_VERSION_NAME = '10.5'
SERVER_VERSION_NUM = '100005'
VERSION_NAME = '10.5'
VERSION_NUM = '100005'
...
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to get connection details from psql -> \e
@ 2018-08-13 14:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: hubert depesz lubaczewski <depesz@depesz.com>
1 sibling, 1 reply; 5+ messages in thread
From: Tom Lane @ 2018-08-13 14:00 UTC (permalink / raw)
To: depesz@depesz.com; +Cc: pgsql-general
hubert depesz lubaczewski <depesz@depesz.com> writes:
> I'm trying to work on some extension to vim when invoked as \e from
> psql.
> To make it fully work, I need to know connection details that psql was
> using while it invoked \e.
Uh, why?
The only likely reason I can guess at is that you want vim to make its
own connection to the database for some purpose like autocompletion.
That's a cute idea, but from a security standpoint it sounds like a
disaster in the making. There isn't any secure way to pass down e.g.
a password (neither command line nor environment variables can be
trusted not to be visible to other users), and even if there was
I'm not sure people would be really happy with handing out their
database credentials to any random piece of code psql invokes.
> Is it possible to do in any way, or if not, any chance it could be added
> to wishlist for next versions of Pg?
You'd need to make a case for it that's a lot stronger than "I wish"
before anyone would consider this.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to get connection details from psql -> \e
@ 2018-08-13 16:04 hubert depesz lubaczewski <depesz@depesz.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: hubert depesz lubaczewski @ 2018-08-13 16:04 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general
On Mon, Aug 13, 2018 at 10:00:56AM -0400, Tom Lane wrote:
> The only likely reason I can guess at is that you want vim to make its
> own connection to the database for some purpose like autocompletion.
That's precisely what I'm looking for.
> That's a cute idea, but from a security standpoint it sounds like a
> disaster in the making. There isn't any secure way to pass down e.g.
> a password (neither command line nor environment variables can be
> trusted not to be visible to other users), and even if there was
> I'm not sure people would be really happy with handing out their
> database credentials to any random piece of code psql invokes.
I think that passing all-but-password would be good enough.
At the very least for my usecases, as I tend to use pgpass and other
non-interactive authentications.
Best regards,
depesz
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: How to get connection details from psql -> \e
@ 2018-08-13 16:04 hubert depesz lubaczewski <depesz@depesz.com>
parent: Laurenz Albe <laurenz.albe@cybertec.at>
0 siblings, 0 replies; 5+ messages in thread
From: hubert depesz lubaczewski @ 2018-08-13 16:04 UTC (permalink / raw)
To: Laurenz Albe <laurenz.albe@cybertec.at>; +Cc: pgsql-general
On Mon, Aug 13, 2018 at 03:32:21PM +0200, Laurenz Albe wrote:
> hubert depesz lubaczewski wrote:
> > I'm trying to work on some extension to vim when invoked as \e from
> > psql.
> >
> > To make it fully work, I need to know connection details that psql was
> > using while it invoked \e.
> >
> > Is it possible to do in any way, or if not, any chance it could be added
> > to wishlist for next versions of Pg?
>
> Do you mean something like \set?
Something like this, but automatically sent "somehow" to editor when
I run \e.
Best regards,
depesz
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-08-13 16:04 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-08-13 10:44 How to get connection details from psql -> \e hubert depesz lubaczewski <depesz@depesz.com>
2018-08-13 13:32 ` Laurenz Albe <laurenz.albe@cybertec.at>
2018-08-13 16:04 ` hubert depesz lubaczewski <depesz@depesz.com>
2018-08-13 14:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-08-13 16:04 ` hubert depesz lubaczewski <depesz@depesz.com>
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