From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: indreek@gmail.com
Subject: BUG #16178: DROP LANGUAGE plpythonu; doesn't actually drop language.
Date: Mon, 23 Dec 2019 09:23:46 +0000
Message-ID: <16178-d556fe3d69ee5271@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 16178
Logged by: Indrek Kalluste
Email address: indreek@gmail.com
PostgreSQL version: 11.6
Operating system: Ubuntu 18
Description:
If you run script:
CREATE SCHEMA IF NOT EXISTS moninfo_2ndq;
CREATE OR REPLACE LANGUAGE plpythonu;
CREATE TYPE moninfo_2ndq.mondata_int AS (name text, value bigint);
CREATE OR REPLACE FUNCTION moninfo_2ndq.pg_wal_info()
RETURNS SETOF moninfo_2ndq.mondata_int AS
$$
import os
filelist = os.listdir('pg_wal')
yield 'PGSERVER.pg_xlog_files', len(filelist)
dirsize = 0
for filename in filelist:
dirsize += os.path.getsize('pg_wal/'+filename)
yield 'PGSERVER.pg_xlog_size', dirsize
$$ language plpythonu security definer;
select * from moninfo_2ndq.pg_wal_info();
---------------------
Exit postgres
---------------------
DROP SCHEMA IF EXISTS moninfo_2ndq CASCADE;
CREATE SCHEMA IF NOT EXISTS moninfo_2ndq;
CREATE TYPE moninfo_2ndq.mondata_int AS (name text, value bigint);
DROP LANGUAGE plpythonu;
CREATE EXTENSION plpython3u;
DROP FUNCTION IF EXISTS moninfo_2ndq.pg_wal_info();
CREATE OR REPLACE FUNCTION moninfo_2ndq.pg_wal_info()
RETURNS SETOF moninfo_2ndq.mondata_int AS
$$
import os
if(os.path.exists('pg_xlog')):
wal_dir = 'pg_xlog/'
else:
wal_dir = 'pg_wal/'
filelist = os.listdir(wal_dir)
yield 'PGSERVER.pg_wal_files', len(filelist)
dirsize = 0
for filename in filelist:
dirsize += os.path.getsize(os.path.join(wal_dir,filename))
yield 'PGSERVER.pg_wal_size', dirsize
$$ language plpython3u security definer;
select * from moninfo_2ndq.pg_wal_info();
#######
And try to run pg_upgrade check, it fails
/usr/lib/postgresql/12/bin/pg_upgrade \
--old-datadir=/var/lib/postgresql/11/main \
--new-datadir=/var/lib/postgresql/12/main \
--old-bindir=/usr/lib/postgresql/11/bin \
--new-bindir=/usr/lib/postgresql/12/bin \
--old-options '-c config_file=/etc/postgresql/11/main/postgresql.conf' \
--new-options '-c config_file=/etc/postgresql/12/main/postgresql.conf' \
--check
I get error:
could not load library "$libdir/plpython2": ERROR: could not access file
"$libdir/plpython2": No such file or directory
Database: test
Doing the same thing with extensions works fine.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, indreek@gmail.com
Subject: Re: BUG #16178: DROP LANGUAGE plpythonu; doesn't actually drop language.
In-Reply-To: <16178-d556fe3d69ee5271@postgresql.org>
References: <16178-d556fe3d69ee5271@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox