Thread: PL/TCL bug (?)

PL/TCL bug (?)

From
Daniele Orlandi
Date:
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
beforeor 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.comViaMezzera 29/A - 20030 - Seveso (MI) - Italy
 
-------------------------------------------------------------------------------


Re: [HACKERS] PL/TCL bug (?)

From
jwieck@debis.com (Jan Wieck)
Date:
Daniele Orlandi 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

    Anything correct so far.

> a=> select tcl_max(3,7);
> ERROR:  Load of file /usr/postgres/lib/pltcl.so failed: /usr/lib/libtcl8.0.so:
> undefined symbol: stat

    There's  something  wrong with your Tcl installation. The Tcl
    shared lib does not correctly  reference  the  library  where
    stat() is in. It was linked with a missing -l...

    You  might  try to link pltcl.so with the additional library.
    Try adding -lm -lc.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #