Re: [HACKERS] Is there any way to access heap_open() from _PG_init ?? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Is there any way to access heap_open() from _PG_init ??
Date
Msg-id 18569.1494599458@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] Is there any way to access heap_open() from _PG_init ??  (Sairam Gaddam <gaddamsairam@gmail.com>)
List pgsql-hackers
Sairam Gaddam <gaddamsairam@gmail.com> writes:
> During startup (_PG_init), I need to access some meta info of
> table/relation (like PK Column Position, FK Column Positions, Index Column
> Positions etc...) and load it into memory.

Why not fetch that info at first use, instead?

If you insist on doing it at _PG_init, you'll never be able to make the
extension work as a shared_preload_libraries item, where _PG_init
would be run in the postmaster.  (I think local_preload_libraries would
be problematic too; not sure that you're inside a transaction there.)
You won't be able to retry after an error, or more generally to cope with
post-load-time changes in the data you want to cache.

It's probably possible to make it work as long as the library gets loaded
during a transaction, ie in response to some SQL command.  Without seeing
your code we can't guess why its crashing though.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression