Re: how to get the connected session pointer ( Archive * AH)

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: how to get the connected session pointer ( Archive * AH)
Date: 2013-10-22 18:59:42
Message-ID: 5266CB1E.5000902@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/22/2013 9:27 AM, AI Rumman wrote:
> I have a libpq C interface code which takes user/password to connect
> to the db. Now, I want to call it from a pgsql function where user
> will not need to put any user name or password, rather it will use the
> current session ID.
> How can I do it? Any idea, please.

you shouldn't be calling libpq from within a postgres C function at all.

if you want to make queries on the same database, use the SPI interface,
see http://www.postgresql.org/docs/current/static/spi.html

If you want to connect to another database, use postgres_fdw

--
john r pierce 37N 122W
somewhere on the middle of the left coast

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2013-10-22 19:02:56 Re: Monitoring number of backends
Previous Message Stephen Frost 2013-10-22 18:50:23 Re: Monitoring number of backends