LOADing functions

From: Andrew Becker <acbecker(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: LOADing functions
Date: 2014-10-31 22:00:57
Message-ID: 54540699.7080006@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi - I seem to be unable to reLOAD a shared library within the session
that I LOADed it. I am developing a UDF and my debugging changes do not
appear to take until I quit psql and restart. The following code
sequence demonstrates the issue

|kbmod=# CREATE OR REPLACE FUNCTION hello(TEXT) RETURNS TEXT
AS '/Users/acbecker/src/github/kbmod/src/hello.so', 'hello'
LANGUAGE C STRICT;

||kbmod=# SELECT hello( name ) FROM test;
hello
----------------
Hello4, Xavier
Hello4, Yari
Hello4, Zack
(3 rows)

### HERE I MODIFY hello.c TO TYPE "Hello5" AND REBUILD hello.so
|

|### DROPPING AND RECREATING THE FUNCTION DOES NOT WORK

kbmod=# DROP FUNCTION hello(TEXT);

kbmod=# CREATE OR REPLACE FUNCTION hello(TEXT) RETURNS TEXT
AS '/Users/acbecker/src/github/kbmod/src/hello.so', 'hello'
LANGUAGE C STRICT;

kbmod=# SELECT hello( name ) FROM test;
hello
---------------
Hello4, Xavier
Hello4, Yari
Hello4, Zack

### RELOADING THE SHARED LIBRARY ALSO DOES NOT HELP
|

|kbmod=# LOAD '/Users/acbecker/src/github/kbmod/src/hello.so';
LOAD

kbmod=# SELECT hello( name ) FROM test;
hello
----------------
Hello4, Xavier
Hello4, Yari
Hello4, Zack
(3 rows)
|
### HOWEVER, AFTER QUITTING AND RESTARTING, THE CHANGE TAKES

|kbmod=# \q

prompt>:/opt/local/lib/postgresql93/bin/psql -U postgres -d kbmod

psql (9.3.5)
Type "help" for help.

kbmod=# SELECT hello( name ) FROM test;
hello
----------------
Hello5, Xavier
Hello5, Yari
Hello5, Zack
(3 rows)|

Hints as to what is going wrong here? I would certainly expect to be
able to re-load a shared library while debugging my UDF.

Thanks,
Andy

psql 9.3.5 from Macports
on OS X 10.10

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2014-10-31 22:13:25 Re: LOADing functions
Previous Message Emanuel Calvo 2014-10-31 19:09:42 Re: Query planning