createlang plpythonu postgres;
createlang: "$libdir/plpython2": No su
ch file or directory
CREATE LANGUAGE plpythonu;
create language 'plpythonu';
select version();
select tmplname, tmplhandler, tmpllibrary from pg_pltemplate where tmplname like 'plpython%'
CREATE LANGUAGE "plpython3u"
SELECT * FROM pg_available_extensions WHERE name LIKE '%python%' ORDER BY name;
CREATE EXTENSION plpython3u FROM unpackaged;
CREATE EXTENSION plpython2u FROM unpackaged;
CREATE EXTENSION plpython3u;
CREATE EXTENSION plpythonu;
CREATE PROCEDURAL LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION iseven(integer)
RETURNS BOOLEAN AS
$BODY$
t = args[0]
return t%2 == 0
$BODY$
LANGUAGE 'plpython3u' VOLATILE
select iseven(3);
createlang: "$libdir/plpython2": No su
ch file or directory
CREATE LANGUAGE plpythonu;
create language 'plpythonu';
select version();
select tmplname, tmplhandler, tmpllibrary from pg_pltemplate where tmplname like 'plpython%'
CREATE LANGUAGE "plpython3u"
SELECT * FROM pg_available_extensions WHERE name LIKE '%python%' ORDER BY name;
CREATE EXTENSION plpython3u FROM unpackaged;
CREATE EXTENSION plpython2u FROM unpackaged;
CREATE EXTENSION plpython3u;
CREATE EXTENSION plpythonu;
CREATE PROCEDURAL LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION iseven(integer)
RETURNS BOOLEAN AS
$BODY$
t = args[0]
return t%2 == 0
$BODY$
LANGUAGE 'plpython3u' VOLATILE
select iseven(3);
3.编译postgresql_9.2.4,原先是9.1.3
[postgres@kenyon ~] $tar -zxvf postgresql_9.2.4.tar.gz
[postgres@kenyon ~] cd postgresql_9.2.4
[postgres@kenyon postgresql_9.2.4]./configure --prefix=/home/postgres --with-pgport=5432 --with-segsize=8 --with-wal-segsize=64 --with-wal-blocksize=64 --with-perl --with-python --with-openssl --with-pam --with-ldap --with-libxml --with-libxslt --enable-thread-safety
[postgres@kenyon postgresql_9.2.4]gmake world
[postgres@kenyon postgresql_9.2.4]gmake install-world
如果顺利的话,这个时候可以看一下BIN是否已经换成9.2.4
[postgres@kenyon postgresql_9.2.4]$ psql -V
psql (PostgreSQL) 9.2.4
[postgres@kenyon postgresql_9.2.4]$
说明BIN文件等已经OK
如果原始版本是9.2.0及以上,可忽略以下步骤,直接启动postgres,如果是9.2.0以下版本,直接启动会报错,则继续,类似initdb与configure版本不一致的问题