From: | Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> |
---|---|
To: | "Brandl, Wolfgang" <wolfgang(dot)brandl(at)brz(dot)gv(dot)at>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: WG: Extension using the current connection handle |
Date: | 2017-12-13 14:46:46 |
Message-ID: | 1513176406.5128.36.camel@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Wolfgang Brandl wrote:
> I have written a extension in postgres to call a Oracle Stored procedure.
> We have a Postgres table holding the usernames and password related to the Oracle SID.
>
> In my extension I wanted to select the username and password out of this table.
> Do I have to make a new Postgres connection or can I somehow use the current connection handel from the session Where the extension will be called?
You would use the SPI interface to query database tables from
a C function:
https://www.postgresql.org/docs/current/static/spi.html
If you don't feel like reinventing the wheel, there are tricks how
to do that with oracle_fdw. You could create an Oracle table with
a BEFORE INSERT trigger that executes the procedure.
See https://stackoverflow.com/a/46360383/6464308
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | PropAAS DBA | 2017-12-13 17:03:56 | virtualized snapshots and PITR |
Previous Message | Brandl, Wolfgang | 2017-12-13 12:59:51 | WG: Extension using the current connection handle |