Thread: Loading shared object files into Postgres

Loading shared object files into Postgres

From
Konstantinos Vassiliadis
Date:
Hello again,
Further to my previous message about loading a shared object file into
Postgres, I have a feeling I cannot establish a connection to the backend
because I am not the postgres "superuser". Reading how a connection is
established between the various Postgres session contents, it says that
"...the postgres servers run with the user-id of the Postgres
"superuser."

Do I have to be the Postgres "superuser" in order to be able to load a
shared object file (just like you need to have "superuser" priviledges in
order to register C functions with Postgres)?

Please point me to the right direction
Kostas Vassiliadis


Re: Loading shared object files into Postgres

From
"Gene Selkov, Jr."
Date:
Konstantinos Vassiliadis wrote:
>
> Do I have to be the Postgres "superuser" in order to be able to load a
> shared object file (just like you need to have "superuser" priviledges in
> order to register C functions with Postgres)?
>

It sure is the same thing (from the manpage on load):
-----------------
If a file is not loaded using the load command, the file will be loaded
automatically the first time the function is called by Postgres. Load
can also be used to reload an object file if it has been edited and
recompiled. Only objects created from C language files are supported at
this time.
-----------------

Your guess on Postgres superuser privileges may be right. It always
worked fine for me, but I never used postgres as anyone other than
postgres (for updates) and nobody (for selects). You can use createuser
to give yourself superuser privileges in postgres (see INTERACTIVE
QUESTIONS) in "man createuser".

Other than that, did you modify the source in tutorial? Did you check
the backend logfile? The error message you reported is too generic. By
the way, if you will ever want to debug your extension, there is
virtually no other way than using fprintf(stderr, ...) or opening a file
and writing into it from inside the code.

--Gene