1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
>Python 2 vs. Python 3</TITLE
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
12
TITLE="PostgreSQL 9.1beta1 Documentation"
13
HREF="index.html"><LINK
15
TITLE="PL/Python - Python Procedural Language"
16
HREF="plpython.html"><LINK
18
TITLE="PL/Python - Python Procedural Language"
19
HREF="plpython.html"><LINK
21
TITLE="PL/Python Functions"
22
HREF="plpython-funcs.html"><LINK
25
HREF="stylesheet.css"><META
26
HTTP-EQUIV="Content-Type"
27
CONTENT="text/html; charset=ISO-8859-1"><META
29
CONTENT="2011-04-27T21:20:33"></HEAD
35
SUMMARY="Header navigation table"
47
>PostgreSQL 9.1beta1 Documentation</A
56
TITLE="PL/Python - Python Procedural Language"
66
TITLE="PL/Python - Python Procedural Language"
74
>Chapter 42. PL/Python - Python Procedural Language</TD
80
TITLE="PL/Python - Python Procedural Language"
89
TITLE="PL/Python Functions"
90
HREF="plpython-funcs.html"
104
NAME="PLPYTHON-PYTHON23"
105
>42.1. Python 2 vs. Python 3</A
108
> PL/Python supports both the Python 2 and Python 3 language
109
variants. (The PostgreSQL installation instructions might contain
110
more precise information about the exact supported minor versions
111
of Python.) Because the Python 2 and Python 3 language variants
112
are incompatible in some important aspects, the following naming
113
and transitioning scheme is used by PL/Python to avoid mixing them:
120
> The PostgreSQL language named <TT
124
implements PL/Python based on the Python 2 language variant.
129
> The PostgreSQL language named <TT
133
implements PL/Python based on the Python 3 language variant.
138
> The language named <TT
142
PL/Python based on the default Python language variant, which is
143
currently Python 2. (This default is independent of what any
144
local Python installations might consider to be
153
default will probably be changed to Python 3 in a distant future
154
release of PostgreSQL, depending on the progress of the
155
migration to Python 3 in the Python community.
161
It depends on the build configuration or the installed packages
162
whether PL/Python for Python 2 or Python 3 or both are available.
171
> The built variant depends on which Python version was found during
172
the installation or which version was explicitly set using
176
> environment variable;
178
HREF="install-procedure.html"
180
>. To make both variants of
181
PL/Python available in one installation, the source tree has to be
182
configured and built twice.
187
> This results in the following usage and migration strategy:
194
> Existing users and users who are currently not interested in
195
Python 3 use the language name <TT
199
don't have to change anything for the foreseeable future. It is
200
recommended to gradually <SPAN
202
>"future-proof"</SPAN
204
via migration to Python 2.6/2.7 to simplify the eventual
205
migration to Python 3.
208
> In practice, many PL/Python functions will migrate to Python 3
209
with few or no changes.
214
> Users who know that they have heavily Python 2 dependent code
215
and don't plan to ever change it can make use of
219
> language name. This will
220
continue to work into the very distant future, until Python 2
221
support might be completely dropped by PostgreSQL.
226
> Users who want to dive into Python 3 can use
230
> language name, which will keep
231
working forever by today's standards. In the distant future,
232
when Python 3 might become the default, they might like to
236
> for aesthetic reasons.
241
> Daredevils, who want to build a Python-3-only operating system
242
environment, can change the contents of
244
HREF="catalog-pg-pltemplate.html"
257
>, keeping in mind that this
258
would make their installation incompatible with most of the rest
268
HREF="http://docs.python.org/py3k/whatsnew/3.0.html"
272
> for more information about porting to
276
> It is not allowed to use PL/Python based on Python 2 and PL/Python
277
based on Python 3 in the same session, because the symbols in the
278
dynamic modules would clash, which could result in crashes of the
279
PostgreSQL server process. There is a check that prevents mixing
280
Python major versions in a session, which will abort the session if
281
a mismatch is detected. It is possible, however, to use both
282
PL/Python variants in the same database, from separate sessions.
290
SUMMARY="Footer navigation table"
319
HREF="plpython-funcs.html"
329
>PL/Python - Python Procedural Language</TD
343
>PL/Python Functions</TD
b'\\ No newline at end of file'