Questions about PostgreSQL's PL/Python procedural language. This extension allows one to write python-based triggers and functions inside of the PostgreSQL RDBMS.
Questions tagged [plpython]
166 questions
6
votes
2 answers
How to install PL/Python on PostgreSQL 9.3 x64 Windows 7?
I have tried to install the PL/Python v2.x language inside PostgreSQL on my database running the query:
CREATE EXTENSION plpythonu;
(I got this from http://www.postgresql.org/docs/9.3/static/plpython.html)
But I'm getting this error:
ERRO: não…

Tiago Stapenhorst
- 708
- 2
- 9
- 22
6
votes
2 answers
Reusing pure Python functions between PL/Python functions
I would like to declare and share some simple, pure python functions between
two or more PL/Python functions. I am using Postgres 9.3.
For example, I have:
CREATE OR REPLACE FUNCTION get_mod(modifier varchar)
RETURNS varchar
AS $$
def…

Edmon
- 4,752
- 4
- 32
- 42
6
votes
2 answers
Is there any recipe to successfully install PLPython in Postgresql 9.3 64bit or 32bit on Windows 64 bits?
running CREATE EXTENSION plpython3u gave me the error - The specified module could not be found even if the file is at the correct place.
After reading everything on the web, I tried to download another python version (3.2) as suggested and replace…

Etienne Desgagné
- 3,102
- 1
- 29
- 36
5
votes
0 answers
Unable to install postgres with python3 support on mac
Both postgres and python3 are already installed on my High Sierra system - so the following was attempted:
brew upgrade postgres --with-python
I had thought that the --with-python would have installed just the postgres plpython3u language support…

WestCoastProjects
- 58,982
- 91
- 316
- 560
5
votes
1 answer
could not load library plpython3.dll
I am getting an error while creating an extension in Postgresql version 10
could not load library "C:/Program Files/PostgreSQL/10/lib/plpython3.dll": The specified module could not be found
CREATE EXTENSION plpython3u;
Note: Using Postgresql 10…

Rahul Gour
- 487
- 2
- 7
- 21
5
votes
1 answer
wrapping postgresql commands in a transaction: truncate vs delete or upsert/merge
I am using the following commands below in postgresql 9.1.3 to move data from a temp staging table to a table being used in a webapp (geoserver) all in the same db. Then dropping the temp table.
TRUNCATE table_foo;
INSERT INTO table_foo
SELECT *…

EnzovsJacques
- 51
- 1
- 3
5
votes
2 answers
Postgres database crash when installing plpython
I'm trying to install plpython in my Postgres 9.1 but it crashes the server:
postgres@dataserver1:~> /opt/postgres/9.1/bin/psql -d mydb
psql.bin (9.1.4)
Type "help" for help.
mydb=# create language 'plpythonu';
The connection to the server was…

alfonso.kim
- 2,844
- 4
- 32
- 37
4
votes
1 answer
How to control which Python version plpython3 uses?
I have a postgres 11 database running on CentOS 7 and am trying to use PL/python, but need to point to a specific version of the python interpreter. I need to use python3.9 whereas it is using python3.6. I am not able to uninstall python3.6 at the…

refriedjello
- 657
- 8
- 18
4
votes
1 answer
Install plpython3u for PostgreSQL 9.5 on CentOS 7.2
Try as I might, I have not succeeded in installing the plpython3u extension on a PostgreSQL 9.5 x64 install.
PostgreSQL 9.5 installed from pgdg repo:
[joe@postgresql ~]$ yum list installed | grep pgdg
CGAL.x86_64 4.7-1.rhel7…

Joebocop
- 539
- 3
- 9
- 17
4
votes
2 answers
Installing plpythonu on Windows
I'm trying to install plpython on a postgres server on a Windows machine. When I issue the command CREATE EXTENSION plpython3u; in postgres, I get the following error, which I'm trying to find the source of.
ERROR: could not load library "C:/Program…

Matthew Plourde
- 43,932
- 7
- 96
- 113
4
votes
1 answer
postgres plpy.execute with hstore string literal FAIL
I'm writing a plpython function using postgresql 9.2. Assume the code has already executed a query that returns hstore strings. I wish to then issue a query:
SELECT hstore_to_matrix('hstorestring')
Let's say that it is a string containing the…

user2288586
- 49
- 3
3
votes
2 answers
PostgreSQL PL/Python: call stored procedure in virtualenv
When I call a PostgreSQL PL/Python stored procedure in my Python application, it seems to be executed in a separate process running as user postgres. So far, this only had the side effect that I had to make my logfile writable for both myself and…

ssc
- 9,528
- 10
- 64
- 94
3
votes
1 answer
How do I pass arguments to my pl/python custom function
I am trying to create my first ever custom function that uses arguments in pl/python. I have created triggers before using pl/python language but these kind of functions don't have arguments.
The code of the function I have created is below:
CREATE…

Faustin Gashakamba
- 226
- 1
- 12
3
votes
1 answer
Use PostgreSQL plpython3u function to return a table
I wanna return table.
The function get an array(the query is 'select function_name(array_agg(column_name)) from table_name')
I coded below:
create type pddesctype as(
count float,
mean float,
std float,
min float
);
create function…

siena
- 39
- 3
3
votes
0 answers
server closed the connection unexpectedly in postgresql while compiling plpytghon3u function
While defining a PL/Python function in psql, I get the error:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The function:
CREATE OR REPLACE…

Rahul Gour
- 487
- 2
- 7
- 21