Loading shared object files into Postgres

Started by Konstantinos Vassiliadisalmost 28 years ago2 messagesgeneral
Jump to latest
#1Konstantinos Vassiliadis
vassilik@p22.cs.man.ac.uk

Hello,
I have issued the "make" command for the $PGROOT/src/tutorial/Makefile
file and then issued

load '/home/postgres/linux/src/tutorial/complex.so'

from interactive psql to load the object file into the address space and
received the following:

"PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
This probably means the backend terminated abnormally before or
while processing the request."

What does that mean? What is wrong?

Kostas Vassiliadis

#2Gene Selkov, Jr.
selkovjr@mcs.anl.gov
In reply to: Konstantinos Vassiliadis (#1)
Re: Loading shared object files into Postgres

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