pg_init

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

pg_init

Natarajan R
I want to read pg_database from pg_init...

Is using heap_open() is possible? or else any other way is there ?
Reply | Threaded
Open this post in threaded view
|

Re: pg_init

Tomas Vondra-4
On Tue, Oct 08, 2019 at 10:03:03PM +0530, Natarajan R wrote:
>I want to read pg_database from pg_init...
>
>Is using heap_open() is possible? or else any other way is there ?

This is way too vague question - I have no idea what you mean by
pg_init, for example. And it's probably a good idea to explain what
you're trying to achieve.

regards

--
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Reply | Threaded
Open this post in threaded view
|

Re: pg_init

Antonin Houska-2
Tomas Vondra <[hidden email]> wrote:

> On Tue, Oct 08, 2019 at 10:03:03PM +0530, Natarajan R wrote:
> >I want to read pg_database from pg_init...
> >
> >Is using heap_open() is possible? or else any other way is there ?
>
> This is way too vague question - I have no idea what you mean by
> pg_init, for example. And it's probably a good idea to explain what
> you're trying to achieve.

This question was familiar to me so I searched the archives. It seems related
to

https://www.postgresql.org/message-id/17058.1570166272%40sss.pgh.pa.us

--
Antonin Houska
Web: https://www.cybertec-postgresql.com


Reply | Threaded
Open this post in threaded view
|

Re: pg_init

Craig Ringer-3
In reply to this post by Natarajan R
On Wed, 9 Oct 2019 at 00:33, Natarajan R <[hidden email]> wrote:
I want to read pg_database from pg_init...

Is using heap_open() is possible? or else any other way is there ?

It's not possible from _PG_init .

I replied to a similar thread with details on how bgworkers can access different databases; look at the archives.

The gist is that you have to register a bgworker that attaches to shared memory and to a database (or use InvalidOid if you only want shared catalog access), then do your work from there.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise