Обсуждение: Querying $libdir

Поиск
Список
Период
Сортировка

Querying $libdir

От
"Nigel J. Andrews"
Дата:

The subject says it really. Is there a way to query the value of $libdir, and I
don't mean the dynamic_library_path GUC?

I ask because, I have scripts to create databases and I've come to make
adjustments to load tsearch2. Now contrib/tsearch2 installs itself into $libdir
with tsearch2.sql installed as $libdir/contrib/tsearch2.sql. So my scripts
either need to know via hardcoding where tsearch2.sql is installed, try to
work it out from file system searching, ask the user running the scripts or
obtain it from the horses mouth.

Hardcoding where I think it is installed is fine until the build happens on a
system I don't control. Same thing for a list of hardcoded likely locations.

File system searching again uses information about where I think things are
installed or tries to determine it by finding out where applications like psql
are located (assuming the picked up psql is part of the same installation as
the backend it is talking to) and doing some jiggery pokery from there, again
making some installation location assumptions to find a suitably named file.

Asking the user is fine, would work and is a reasonably quick solution. It just
spoils the look of things when scripts run by other scripts start pestering the
user for info about the system things.

Or, I could just ask the horses mouth by issuing a query in the backend via
psql.

Guess which I think I want to use. The question being is this even possible in
a stock 7.3 server?

I know it's not the right list but seeing as I'm emailing. tsearch2 doesn't
even compile outside of contrib/ I presume that is necessary? Is there any
particular reason why the stop word files are installed with no permissions for
'world'? It kinda screws up installing as one user and running as another.


--
Nigel J. Andrews


Re: Querying $libdir

От
"Nigel J. Andrews"
Дата:
Replying to myself...

On Wed, 3 Sep 2003, Nigel J. Andrews wrote:
>
> The subject says it really. Is there a way to query the value of $libdir, and I
> don't mean the dynamic_library_path GUC?
>
> I ask because, I have scripts to create databases and I've come to make
> adjustments to load tsearch2. Now contrib/tsearch2 installs itself into $libdir
> with tsearch2.sql installed as $libdir/contrib/tsearch2.sql...

I got that wrong, it actually installs tsearch2.sql into
$libdir/../share/contrib/ without specifically setting a different location for
shared files.

However, I also note that the functions are installed into public schema. That
looked fine when I first checked that it wasn't polluting namespaces in the
search path. Unfortunately, the database I'm looking at at the moment doesn't
have public in the user's search paths. Therefore, I'm going to have to bring
tsearch2 into my own release procedures, something not made easy by it only
being compilable within the contrib directory of the main source tree.


--
Nigel J. Andrews


Re: Querying $libdir

От
psql-mail@freeuk.com
Дата:
>
> Replying to myself...
>
> On Wed, 3 Sep 2003, Nigel J. Andrews wrote:
> >
> > The subject says it really. Is there a way to query the value of $
libdir, and I
> > don't mean the dynamic_library_path GUC?

<SNIP>

Nigel,

I don't know of a way of querying $libdir directly, but you can find
out its value using
pg_config --libdir

Hope that Helps

--

Re: Querying $libdir

От
"Nigel J. Andrews"
Дата:
On Wed, 3 Sep 2003 psql-mail@freeuk.com wrote:

> >
> > Replying to myself...
> >
> > On Wed, 3 Sep 2003, Nigel J. Andrews wrote:
> > >
> > > The subject says it really. Is there a way to query the value of $
> libdir, and I
> > > don't mean the dynamic_library_path GUC?
>
> <SNIP>
>
> Nigel,
>
> I don't know of a way of querying $libdir directly, but you can find
> out its value using
> pg_config --libdir
>
> Hope that Helps

LOL, can you say dimwit? I completely forgot about that even though I knew it
did that and indeed use it elsewhere. It's not perfect in that it doesn't tell
me what the backend is using unless it's from the same installation but it's
certainly close enough.

Thanks, my excuse is it was late when I was looking at this issue.

--
Nigel J. Andrews


Re: Querying $libdir

От
Tom Lane
Дата:
"Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> On Wed, 3 Sep 2003 psql-mail@freeuk.com wrote:
>> I don't know of a way of querying $libdir directly, but you can find
>> out its value using
>> pg_config --libdir

> LOL, can you say dimwit? I completely forgot about that even though I knew it
> did that and indeed use it elsewhere.

BTW, I think that the backend's $libdir actually corresponds to what
pg_config calls --pkglibdir.  They are the same directory in some
configurations, but not all.

            regards, tom lane