Wow!

What are the odds...

I had just created a C function which would allow
the database to determine wether or not a file exists
somewhere on the filesystem (readable by user
postgres, of course) and return 0 if not and
1 if the file exists.  I then used the function in 
a VIEW and used a MS Access front-end to make 
pretty reports from the view, and I arrived at the
exact same symbol missing from the dynamic linker,
since I used stat() to test for the existence of the
file.  I wound up using fopen() (a poor alternative)
in the custom function, because the backend didn't
have any linker problems with it.  I spent hours
working under the assumption that I was using the
wrong compiler flags with gcc and ld, and finally
gave up trying to use stat().  Note that this could
still be the case...

I have the EXACT same configuration as you:

Intel
Linux RedHat 5.2
Kernel 2.0.36
PostgreSQL 6.4

Interesting....

---Daniele Orlandi <daniele@orlandi.com> wrote:
>
> 
> Hi,
> 
> I'm having serious problems with postgresql and TCL as a procedural
language.
> 
> I did a clean compilantion and install --with-tcl.
> I did an initdb, created the language and a demo function found on
the site.
> 
> This is the result:
> 
> a=> create function pltcl_call_handler() returns opaque
> a->         as '/usr/postgres/lib/pltcl.so'
> a->         language 'C';
> CREATE
> a=>
> a=> create trusted procedural language 'pltcl'
> a->         handler pltcl_call_handler
> a->         lancompiler 'PL/Tcl';
> CREATE
> a=> CREATE FUNCTION tcl_max (int4, int4) RETURNS int4 AS '
> a'>         if {$1 > $2} {return $1}
> a'>         return $2
> a'>     ' LANGUAGE 'pltcl';
> CREATE
> a=> select tcl_max(3,7);
> ERROR:  Load of file /usr/postgres/lib/pltcl.so failed:
/usr/lib/libtcl8.0.so:
> undefined symbol: stat
> 
> a=> select tcl_max(3,7);
> pqReadData() -- backend closed the channel unexpectedly.
>         This probably means the backend terminated abnormally before
or while
> processing the request.
> We have lost the connection to the backend, so further processing is
> impossible.  Terminating.
> ----------
> 
> The same happens on two other 6.4.0 - 6.4.2 installations. All
machines are
> Intel based RedHat 5.2 Linuxes with kernel 2.0.36, tcl-8.0.3.
> I wasn't able to test this with the current snapshot because I
hadn't been able
> to initdb.
> 
> Any guess ?
> 
> Bye!
> 
> -- 
>  Daniele
> 
>
-------------------------------------------------------------------------------
>  Daniele Orlandi - Utility Line Italia - http://www.orlandi.com
>  Via Mezzera 29/A - 20030 - Seveso (MI) - Italy
>
-------------------------------------------------------------------------------
> 
> 

_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


Tue, 2 Feb 1999 21:45:38 -0800 (PST)
Marcus Mascari <mascarim@yahoo.com>
Re: [HACKERS] PL/TCL bug (?)