|From:||Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>|
|Subject:||Resolving the python 2 -> python 3 mess|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
We've had multiple previous discussions of $SUBJECT (eg ),
without any resolution of what to do exactly. Thinking about this
some more, I had an idea that I don't think has been discussed.
1. On platforms where Python 2.x is still supported, recommend that
packagers continue to build both plpython2 and plpython3, same as now.
2. On platforms where Python 2.x is no longer supported, transparently
map plpythonu and plpython2u to plpython3u. "Transparent" meaning that
dump/reload or pg_upgrade of existing plpythonu/plpython2u functions
will work, but when you run them, what you actually get is Python 3.x.
For existing functions that don't use any obsolete Python syntax
(which one would hope is a pretty large percentage), this is a
zero-effort conversion for users. If a function does use obsolete
constructs, it will get a parse failure when executed, and the user
will have to update it to Python 3 syntax. I propose that we make
that case reasonably painless by providing the conversion script
I posted in  (or another one if somebody's got a better one),
bundled as a separately-installable extension.
A possible gotcha in this approach is if there are any python 2/3
incompatibilities that would not manifest as syntax errors or
obvious runtime errors, but would allow old code to execute and
silently do the wrong thing. One would hope that the Python crowd
weren't dumb enough to do that, but I don't know whether it's true.
If there are nasty cases like that, maybe what we have to do is allow
plpythonu/plpython2u functions to be dumped and reloaded into a
python-3-only install, but refuse to execute them until they've
In either case, to allow dump/reload or pg_upgrade to work without
ugly hacks, what we need to do is provide a stub version of
plpython2.so. (The extension definitions that sit on top of it
then don't need to change.) The stub would either redirect calls
to plpython3.so if we prefer that approach, or throw errors if we
prefer that approach. I envision adding a configure option that
enables build and install of this stub library while doing a
plpython3 build; packagers not planning to build a "real" plpython2
should ask for the stub instead.
The end result given the first approach is that "plpythonu" and
"plpython2u" and "plpython3u" all work and mean the same thing.
Over some long time period we might want to deprecate and remove
the "plpython2u" alias, but there would be no hurry about it.
The work involved in making this happen seems fairly minimal, and
practical to get done in time for PG 13. Perhaps there'd even be
a case for back-patching it, though I'm not going to advocate for
regards, tom lane
|Next Message||Juan José Santamaría Flecha||2020-02-17 17:24:30||Re: Fix compiler warnings on 64-bit Windows|
|Previous Message||Dmitry Dolgov||2020-02-17 16:24:51||Re: Index Skip Scan|