From: | <david(at)andl(dot)org> |
---|---|
To: | <david(at)andl(dot)org>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to find configuration data in _PG_init() |
Date: | 2016-03-10 23:29:11 |
Message-ID: | 004701d17b24$a93d9700$fbb8c500$@andl.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> owner(at)postgresql(dot)org] On Behalf Of Adrian Klaver
> > My language handler requires some configuration information to start
> > up, which I would like to get from the file system (but it could be
> > set up by an SQL query SET). Currently I’m using hard-coded paths,
> > which doesn’t seem like a good solution. Is there perhaps a way to
> get
> > the path that was used to load the DLL? I couldn’t find one in the
> > existing language implementations.
>
> There is pg_config:
>
> http://www.postgresql.org/docs/9.5/interactive/app-pgconfig.html
Thanks for the response, but this doesn't help. This is a standalone exe and it relies on the command line to find its own path.
I need something that works in _PG_init(), which has no arguments passed in, and can only make calls to the C api.
> At the moment it is only available from the above command. In 9.6:
>
> http://www.depesz.com/2016/02/29/waiting-for-9-6-add-new-system-view-
> pg_config/
>
> it also be available in a system view.
So what C api calls does that implementation make to find this information?
>
> There are the following systems catalogs that give you information
> about
> languages:
>
> http://www.postgresql.org/docs/9.5/interactive/catalog-pg-
> language.html
>
> http://www.postgresql.org/docs/9.5/interactive/catalog-pg-
> pltemplate.html
> http://www.postgresql.org/docs/9.5/interactive/catalog-pg-proc.html
Yes, I'm familiar with all those. One possibility is to retrieve pg_proc.probin, which appears to always contain the relevant path.
>
> >
> > Having got started it then needs to query the database. Is that OK
> in
> > _PG_init()?
Regards
David M Bennett FACS
Andl - A New Database Language - andl.org
From | Date | Subject | |
---|---|---|---|
Next Message | Robert McAlpine | 2016-03-11 00:11:18 | Cannot create role, no default superuser role exists |
Previous Message | Karsten Hilbert | 2016-03-10 21:09:43 | Re: pg_restore without dropping db/table |