Re: loading .so file at run time

Lists: pgsql-hackerspgsql-novice
From: Rajmohan C <csrajmohan(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: loading .so file at run time
Date: 2014-06-13 06:29:36
Message-ID: CAHaqV0hv4kG9GXzo1FLMoWxuXW9=v84UZp=2dYXAi1f35q_PTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-novice

I am working with Postgresql 9.3.4 source using eclipse IDE in ubuntu
14.04. I have a library file abc.so to be loaded at run time when
postgresql server starts. When I run the server with

"-D /home/rajmohan/projects/TPCH_database"

as argument in run configuration, I could see LOG message abc.so library
loaded and I am able to call library methods at run time. But this requires
a client to connect to server and pass cmds. But I want a stand-alone
postgres server such that I can give commands directly from eclipse command
prompt itself. For that when I set the argument in run configuration as

"--single -D /home/rajmohan/projects/TPCH_database tpch",

the library loaded log message doesnot appears and library does not load.
How to load the library on stand-alone server and work?


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Rajmohan C <csrajmohan(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: loading .so file at run time
Date: 2014-06-13 07:20:05
Message-ID: CAB7nPqQqqin1YoYmKnDa6ur=tUvMUL7s_sXKeR-2VZOwBTRssw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-novice

On Fri, Jun 13, 2014 at 3:29 PM, Rajmohan C <csrajmohan(at)gmail(dot)com> wrote:
> I am working with Postgresql 9.3.4 source using eclipse IDE in ubuntu 14.04.
> I have a library file abc.so to be loaded at run time when postgresql server
> starts. When I run the server with
>
> "-D /home/rajmohan/projects/TPCH_database"
>
> as argument in run configuration, I could see LOG message abc.so library
> loaded and I am able to call library methods at run time. But this requires
> a client to connect to server and pass cmds. But I want a stand-alone
> postgres server such that I can give commands directly from eclipse command
> prompt itself. For that when I set the argument in run configuration as
>
> "--single -D /home/rajmohan/projects/TPCH_database tpch",
>
> the library loaded log message doesnot appears and library does not load.
> How to load the library on stand-alone server and work?
Is it a custom extension that you are developing? Here you go:
http://www.postgresql.org/docs/devel/static/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-PRELOAD
For an extension that needs to be loaded use shared_preload_libraries.
--
Michael