Re: WG: Extension using the current connection handle

Поиск
Список
Период
Сортировка
От Brandl, Wolfgang
Тема Re: WG: Extension using the current connection handle
Дата
Msg-id F2EB158D72DC6A4F97877DD0BB6F020E6138D643@CMD0MBX-AB01.cmd0.cna.at
обсуждение исходный текст
Ответ на WG: Extension using the current connection handle  ("Brandl, Wolfgang" <wolfgang.brandl@brz.gv.at>)
Ответы Re: WG: Extension using the current connection handle  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-admin
Hello
Thanks for the Tipp with the SPI.
We are not using oracle_fdw, becaue we got somehow problems with the connection. Therefore some of the transactions get
lostand all following didn't get a connection.
 
We did not analyse this.

Regards Wolfgang

-----Ursprüngliche Nachricht-----
Von: Laurenz Albe [mailto:laurenz.albe@cybertec.at] 
Gesendet: Mittwoch, 13. Dezember 2017 15:47
An: Brandl, Wolfgang; pgsql-admin@postgresql.org
Betreff: Re: WG: Extension using the current connection handle

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
theextension 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
Oracletable with a BEFORE INSERT trigger that executes the procedure.
 

See https://stackoverflow.com/a/46360383/6464308

Yours,
Laurenz Albe

В списке pgsql-admin по дате отправления:

Предыдущее
От: Om Prakash Jaiswal
Дата:
Сообщение: Couldn't create plperl language
Следующее
От: Devrim Gündüz
Дата:
Сообщение: Re: Couldn't create plperl language