Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpDPC-0001Kk-7J for pgsql-general@arkaria.postgresql.org; Mon, 13 Aug 2018 14:01:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpDP9-0001ZB-Vt for pgsql-general@arkaria.postgresql.org; Mon, 13 Aug 2018 14:01:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpDP9-0001Z3-Kd for pgsql-general@lists.postgresql.org; Mon, 13 Aug 2018 14:01:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpDP6-0003wc-Vu for pgsql-general@postgresql.org; Mon, 13 Aug 2018 14:01:06 +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 w7DE0uYs017127; Mon, 13 Aug 2018 10:00:56 -0400 From: Tom Lane To: depesz@depesz.com cc: pgsql-general mailing list Subject: Re: How to get connection details from psql -> \e In-reply-to: <20180813104415.hatiez4soz6jvozp@depesz.com> References: <20180813104415.hatiez4soz6jvozp@depesz.com> Comments: In-reply-to hubert depesz lubaczewski message dated "Mon, 13 Aug 2018 12:44:15 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17125.1534168856.1@sss.pgh.pa.us> Date: Mon, 13 Aug 2018 10:00:56 -0400 Message-ID: <17126.1534168856@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk hubert depesz lubaczewski 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