PostgreSQL之安装plpython

2016/11/03 PostgreSQL 共 824 字,约 3 分钟

参考

installing-plpython

实例

方法一

1.configure指定参数

./configure 改为      ./configure --with-python
## 然后正常安装即可

2.登陆用户

psql -U postgres -d postgres

 

3.创建语言

postgres=# create extension plpython2u;
postgres=# create extension plpythonu;

 

4.确认plpython是否添加成功

postgres=# select * from pg_language

方法二

说明

## 在安装的时候没有加参数--with-python的安装方法

1.将源码包放入你的工作目录/work

2.解压源码包

3.进入源码包中

cd /work/postgresql-x.x.x

4.编译源码包

./configure --with-python --prefix=${source_dir}
make
su
make install
#其中目录source_dir有自己指定

 

5.将编译后获得的extension/plpython放入$PGHOME/share/extension/

cp ${source_dir}/share/postgresql/extension/plpython* $PGHOME/share/extension/

6.将编译后获得的plpython2.so放入$PGHOME/share/extension/

cp ${source_dir}/lib/postgresql/plpython2.so ${PGHOME}/lib/

 

7.登陆用户

postgres=# psql -U postgres -d postgres

8.创建语言

postgres=# create extension plpython2u;
postgres=# create extension plpythonu;

9.确认plpython是否添加成功

select * from pg_language;

文档信息

Search

    Table of Contents