dbTalk Databases Forums  

[BUGS] LOAD broken?

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] LOAD broken? in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dennis Bjorklund
 
Posts: n/a

Default [BUGS] LOAD broken? - 09-06-2003 , 05:40 AM






I've got a C function in a .so that I use in postgres. While developing it
I want to reload the dynamic library. The docs says that LOAD should do
the trick but nothing happens when I use it.

Have LOAD stoped working and is it now a NOP?

I've tried LOAD both when the function exists in pg, and when I first drop
the function, do the load and then create the function again. But it makes
no difference.

I run redhat 9, maybe load works in other dists/operating systems?

--
/Dennis


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] LOAD broken? - 09-06-2003 , 09:24 PM






Dennis Bjorklund <db (AT) zigo (DOT) dhs.org> writes:
Quote:
I've got a C function in a .so that I use in postgres. While developing it
I want to reload the dynamic library. The docs says that LOAD should do
the trick but nothing happens when I use it.
You're right, this seems not to work on Linux. I've applied the
attached patch to CVS tip.

regards, tom lane

*** src/backend/utils/fmgr/dfmgr.c.orig Sun Aug 3 23:01:07 2003
--- src/backend/utils/fmgr/dfmgr.c Sat Sep 6 22:13:25 2003
***************
*** 177,183 ****
load_file(char *filename)
{
DynamicFileList *file_scanner,
! *p;
struct stat stat_buf;
char *fullname;

--- 178,185 ----
load_file(char *filename)
{
DynamicFileList *file_scanner,
! *prv,
! *nxt;
struct stat stat_buf;
char *fullname;

***************
*** 196,226 ****
(errcode_for_file_access(),
errmsg("could not access file \"%s\": %m", fullname)));

! if (file_list != (DynamicFileList *) NULL)
{
! if (SAME_INODE(stat_buf, *file_list))
{
! p = file_list;
! file_list = p->next;
! pg_dlclose(p->handle);
! free((char *) p);
}
else
! {
! for (file_scanner = file_list;
! file_scanner->next != (DynamicFileList *) NULL;
! file_scanner = file_scanner->next)
! {
! if (SAME_INODE(stat_buf, *(file_scanner->next)))
! {
! p = file_scanner->next;
! file_scanner->next = p->next;
! pg_dlclose(p->handle);
! free((char *) p);
! break;
! }
! }
! }
}

load_external_function(fullname, (char *) NULL, false, (void *) NULL);
--- 198,224 ----
(errcode_for_file_access(),
errmsg("could not access file \"%s\": %m", fullname)));

! /*
! * We have to zap all entries in the list that match on either filename
! * or inode, else load_external_function() won't do anything.
! */
! prv = NULL;
! for (file_scanner = file_list; file_scanner != NULL; file_scanner = nxt)
{
! nxt = file_scanner->next;
! if (strcmp(fullname, file_scanner->filename) == 0 ||
! SAME_INODE(stat_buf, *file_scanner))
{
! if (prv)
! prv->next = nxt;
! else
! file_list = nxt;
! pg_dlclose(file_scanner->handle);
! free((char *) file_scanner);
! /* prv does not change */
}
else
! prv = file_scanner;
}

load_external_function(fullname, (char *) NULL, false, (void *) NULL);

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.