Thread: Testing for a shared library

Testing for a shared library

From
Christopher Kings-Lynne
Date:
Hi,

Is there any way of checking to see if a particular shared library is 
installed?

eg. select is_shared_library('$libdir/tsearch2');

If not, can we please have one :D

This will greatly help in GUI apps like phpPgAdmin...

Chris


Re: Testing for a shared library

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of
> Christopher Kings-Lynne
> Sent: 07 September 2005 09:03
> To: PostgreSQL-development
> Subject: [HACKERS] Testing for a shared library
>
> Hi,
>
> Is there any way of checking to see if a particular shared library is
> installed?
>
> eg. select is_shared_library('$libdir/tsearch2');

How well do you know the library you are looking for? You could just try
creating a function from it and seeing if it fails.

Regards, Dave.


Re: Testing for a shared library

From
Christopher Kings-Lynne
Date:
>>Is there any way of checking to see if a particular shared library is 
>>installed?
>>
>>eg. select is_shared_library('$libdir/tsearch2');
> 
> 
> How well do you know the library you are looking for? You could just try
> creating a function from it and seeing if it fails.

I know it pretty well, but it seems kind of lame to have to create the 
function and test for it, especialyl if you have a non-error tolerating 
environment.

Plus, you have to know what exported functions it has and you have to 
worry about creating any input and return types, etc.

Chris


Re: Testing for a shared library

From
"Dave Page"
Date:

> -----Original Message-----
> From: Christopher Kings-Lynne [mailto:chriskl@familyhealth.com.au]
> Sent: 07 September 2005 09:16
> To: Dave Page
> Cc: PostgreSQL-development
> Subject: Re: [HACKERS] Testing for a shared library
>
> >>Is there any way of checking to see if a particular shared
> library is
> >>installed?
> >>
> >>eg. select is_shared_library('$libdir/tsearch2');
> >
> >
> > How well do you know the library you are looking for? You
> could just try
> > creating a function from it and seeing if it fails.
>
> I know it pretty well, but it seems kind of lame to have to
> create the
> function and test for it, especialyl if you have a non-error
> tolerating
> environment.

Yeah, but if you need a quick hack...

> Plus, you have to know what exported functions it has and you have to
> worry about creating any input and return types, etc.

That's why I asked how well you know the library :-)

/D


Re: Testing for a shared library

From
Teodor Sigaev
Date:
As you know, presence of shared library doesn't mean precense of module in db :).


You can try selecting:

# select count(*) from pg_opclass where opcname = 'tsvector_ops';

or, more general,

# select count(*) from pg_proc where probin = '$libdir/tsearch2';


But not all modules adds new function...




Christopher Kings-Lynne wrote:
> Hi,
> 
> Is there any way of checking to see if a particular shared library is 
> installed?
> 
> eg. select is_shared_library('$libdir/tsearch2');
> 
> If not, can we please have one :D
> 
> This will greatly help in GUI apps like phpPgAdmin...
> 
> Chris
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
  WWW: http://www.sigaev.ru/
 


Re: Testing for a shared library

From
Christopher Kings-Lynne
Date:
No, I want to check that the shared library exists (eg. the slony 
libraries) BEFORE executing the slony sql script that creates all the 
objects.

Chris

Teodor Sigaev wrote:
> As you know, presence of shared library doesn't mean precense of module 
> in db :).
> 
> 
> You can try selecting:
> 
> # select count(*) from pg_opclass where opcname = 'tsvector_ops';
> 
> or, more general,
> 
> # select count(*) from pg_proc where probin = '$libdir/tsearch2';
> 
> 
> But not all modules adds new function...
> 
> 
> 
> 
> Christopher Kings-Lynne wrote:
> 
>> Hi,
>>
>> Is there any way of checking to see if a particular shared library is 
>> installed?
>>
>> eg. select is_shared_library('$libdir/tsearch2');
>>
>> If not, can we please have one :D
>>
>> This will greatly help in GUI apps like phpPgAdmin...
>>
>> Chris
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: Don't 'kill -9' the postmaster
> 
> 


Re: Testing for a shared library

From
Tom Lane
Date:
Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> Is there any way of checking to see if a particular shared library is 
> installed?

Try to LOAD it, perhaps.
        regards, tom lane