On May 5, 1:34 am, [EMAIL PROTECTED] (Peter Eisentraut) wrote:
> roger wrote:
> > Where can I configure which version (or path) that postgres will use?
> It uses whatever "python" program it can find first in the path.  If
> your observation is different, please show the relevant output from
> configure or config.log.
> --
> Peter Eisentrauthttp://developer.postgresql.org/~petere/
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

Hi Peter,
After doing a little more digging, it appears as if the python version
used is hardcoded into the plpython.so  (I'm not sure if plpython.so
is actually doing the python interpretation itself or not)

this is an ldd output on my plpython.so:

# ldd plpython.so
        libpython2.3.so.1.0 => /usr/lib/libpython2.3.so.1.0
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0x00edd000)
        libdl.so.2 => /lib/libdl.so.2 (0x00981000)
        libutil.so.1 => /lib/libutil.so.1 (0x00111000)
        libm.so.6 => /lib/tls/libm.so.6 (0x00693000)
        libc.so.6 => /lib/tls/libc.so.6 (0x006bd000)
        /lib/ld-linux.so.2 (0x0091c000)

I installed postgres from RHES 4 RPM.  So not sure if that
libpython2.3 dependency was done by the RPM builder or was done when I
did the install.  My pg_config seems to indicate the install
configuration used the directories (/usr/lib and /usr/bin) where my
Python 2.3 is (Python 2.4 is in /usr/local/bin)

So I'm now wondering how I can get the plpython.so to depend on
python2.4.  Do I have to reinstall, or is there some way of just
redoing the plpython.so?

The really weird part is that I wrote a plpython script to write out
python environment vars:

    import sys
    plpy.notice("python exec = '%s'" % sys.executable)
    plpy.notice("python version = '%s'" % sys.version)
    plpy.notice("python path = '%s'" % sys.path)
    return 1
$$ LANGUAGE plpythonu;

And I get the following output:
NOTICE:  ("python exec = '/usr/local/bin/python'",)
NOTICE:  ("python version = '2.3.4 (#1, Oct 11 2006, 06:18:43) \n[GCC
3.4.6 20060404 (Red Hat 3.4.6-3)]'",)
NOTICE:  ("python path = '['/usr/lib/python23.zip', '/usr/lib/
python2.3', '/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-
tk', '/usr/lib/python2.3/lib-dynload', '/usr/lib/python2.3/site-
packages', '/usr/lib/python2.3/site-packages/gtk-2.0']'",)

The weird part being the first line:  plpython thinks it's being run
from /usr/local/bin/python (which is 2.4), when the second line
clearly indicates version 2.3

Anyways, for completeness, my pg_config gives:

# pg_config
BINDIR = /usr/bin
DOCDIR = /usr/share/doc/pgsql
INCLUDEDIR = /usr/include
PKGINCLUDEDIR = /usr/include/pgsql
INCLUDEDIR-SERVER = /usr/include/pgsql/server
LIBDIR = /usr/lib
PKGLIBDIR = /usr/lib/pgsql
LOCALEDIR = /usr/share/locale
MANDIR = /usr/share/man
SHAREDIR = /usr/share/pgsql
SYSCONFDIR = /etc/sysconfig/pgsql
PGXS = /usr/lib/pgsql/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-
gnu' '--target=i686-redhat-linux-gnu' '--program-prefix=' '--prefix=/
usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--
sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--
libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--
sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/
share/info' '--disable-rpath' '--with-perl' '--with-tcl' '--with-
tclconfig=/usr/lib' '--with-python' '--with-openssl' '--with-pam' '--
with-krb5' '--with-includes=/usr/include' '--with-libraries=/usr/lib'
'--enable-nls' '--sysconfdir=/etc/sysconfig/pgsql' '--datadir=//usr/
share/pgsql' '--with-docdir=/usr/share/doc' 'CFLAGS=-O2 -g -pipe -m32 -
march=i686 -mtune=pentium4 -I/usr/include/et' 'CPPFLAGS= -I/usr/
include/et' 'build_alias=i686-redhat-linux-gnu' 'host_alias=i686-
redhat-linux-gnu' 'target_alias=i686-redhat-linux-gnu'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE -I/usr/include
CFLAGS = -O2 -g -pipe -m32 -march=i686 -mtune=pentium4 -I/usr/include/
et -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-
after-statement -Wendif-labels -fno-strict-aliasing
CFLAGS_SL = -fpic
LDFLAGS = -L/usr/lib
LIBS = -lpgport -lpam -lssl -lcrypto -lkrb5 -lz -lreadline -ltermcap -
lcrypt -lresolv -lnsl -ldl -lm -lbsd
VERSION = PostgreSQL 8.1.5

So, any ideas on how I can get plpython.so to use Python 2.4?
Any help is greatly appreciated.

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to