pgsql: Avoid dump/reload problems when using both plpython2 and plpytho

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Avoid dump/reload problems when using both plpython2 and plpytho
Дата
Msg-id E1aInFd-0004Ol-6q@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Avoid dump/reload problems when using both plpython2 and plpython3.

Commit 803716013dc1350f installed a safeguard against loading plpython2
and plpython3 at the same time, but asserted that both could still be
used in the same database, just not in the same session.  However, that's
not actually all that practical because dumping and reloading will fail
(since both libraries necessarily get loaded into the restoring session).
pg_upgrade is even worse, because it checks for missing libraries by
loading every .so library mentioned in the entire installation into one
session, so that you can have only one across the whole cluster.

We can improve matters by not throwing the error immediately in _PG_init,
but only when and if we're asked to do something that requires calling
into libpython.  This ameliorates both of the above situations, since
while execution of CREATE LANGUAGE, CREATE FUNCTION, etc will result in
loading plpython, it isn't asked to do anything interesting (at least
not if check_function_bodies is off, as it will be during a restore).

It's possible that this opens some corner-case holes in which a crash
could be provoked with sufficient effort.  However, since plpython
only exists as an untrusted language, any such crash would require
superuser privileges, making it "don't do that" not a security issue.
To reduce the hazards in this area, the error is still FATAL when it
does get thrown.

Per a report from Paul Jones.  Back-patch to 9.2, which is as far back
as the patch applies without work.  (It could be made to work in 9.1,
but given the lack of previous complaints, I'm disinclined to expend
effort so far back.  We've been pretty desultory about support for
Python 3 in 9.1 anyway.)

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/0ddeaba7ed88151fd90b5d13d50beca2aff0ab39

Modified Files
--------------
src/pl/plpython/plpy_main.c |   81 +++++++++++++++++++++++++++++++++++++------
1 file changed, 71 insertions(+), 10 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Avoid dump/reload problems when using both plpython2 and plpytho
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Avoid dump/reload problems when using both plpython2 and plpytho