Re: Accessiing database from inside of postgresql C function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yan Pas <yanp(dot)bugz(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Accessiing database from inside of postgresql C function
Date: 2017-09-05 17:32:45
Message-ID: 6318.1504632765@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yan Pas <yanp(dot)bugz(at)gmail(dot)com> writes:
> I'm writing C postgresql module with postgresql functions and want to
> access the tables from inside (SELECT mostly and maybe INSERT). Is it
> possible? If yes what API can I use except classic TCP connection (not sure
> if it's even legal)?

Recommended way is to use SPI:
https://www.postgresql.org/docs/current/static/spi.html

Aside from that documentation, there are lots of examples to study in the
core code and contrib.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message milist ujang 2017-09-05 17:52:14 BDR, wal segment has been removed, is it possible move forward?
Previous Message Yan Pas 2017-09-05 17:21:39 Accessiing database from inside of postgresql C function