Skip to content

Commit 7f6bf4a

Browse files
authored
docs: document Python 3.12+ incompatibility with multicorn2 + PL/Python (#73)
* document Python 3.12+ incompatibility with PL/Python * (minor tweak): reorder build, preventing changes to python code from causing a PostgreSQL rebuild
1 parent dd15a43 commit 7f6bf4a

File tree

3 files changed

+31
-13
lines changed

3 files changed

+31
-13
lines changed

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ PYTHON_TEST_VERSION ?= $(python_version)
110110
PG_TEST_VERSION ?= $(MAJORVERSION)
111111
UNSUPPORTS_SQLALCHEMY=$(shell python -c "import sqlalchemy;import psycopg2" 1> /dev/null 2>&1; echo $$?)
112112

113+
# Check if Python version is 3.12 or greater
114+
PYTHON_VERSION_MAJOR_MINOR=$(shell python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")
115+
PYTHON_GE_312=$(shell python -c "import sys; print(1 if (sys.version_info.major, sys.version_info.minor) >= (3, 12) else 0)")
116+
113117
TESTS = test-$(PYTHON_TEST_VERSION)/sql/multicorn_cache_invalidation.sql \
114118
test-$(PYTHON_TEST_VERSION)/sql/multicorn_column_options_test.sql \
115119
test-$(PYTHON_TEST_VERSION)/sql/multicorn_error_test.sql \
@@ -121,11 +125,15 @@ TESTS = test-$(PYTHON_TEST_VERSION)/sql/multicorn_cache_invalidation.sql
121125
test-$(PYTHON_TEST_VERSION)/sql/multicorn_test_dict.sql \
122126
test-$(PYTHON_TEST_VERSION)/sql/multicorn_test_list.sql \
123127
test-$(PYTHON_TEST_VERSION)/sql/multicorn_test_sort.sql \
124-
test-$(PYTHON_TEST_VERSION)/sql/write_filesystem.sql \
125128
test-$(PYTHON_TEST_VERSION)/sql/write_savepoints.sql \
126129
test-$(PYTHON_TEST_VERSION)/sql/write_test.sql \
127130
test-$(PYTHON_TEST_VERSION)/sql/import_test.sql
128131

132+
# Only include write_filesystem.sql for Python versions < 3.12
133+
ifneq ($(PYTHON_GE_312), 1)
134+
TESTS += test-$(PYTHON_TEST_VERSION)/sql/write_filesystem.sql
135+
endif
136+
129137
ifeq (${UNSUPPORTS_SQLALCHEMY}, 0)
130138
TESTS += test-$(PYTHON_TEST_VERSION)/sql/multicorn_alchemy_test.sql \
131139
test-$(PYTHON_TEST_VERSION)/sql/write_sqlalchemy.sql \

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Multicorn2
33
==========
44

5-
Multicorn Python3 Foreign Data Wrapper (FDW) for Postgresql. Tested on Linux w/ Python 3.9-3.12 & Postgres 13-17.
5+
Multicorn Python3 Foreign Data Wrapper (FDW) for Postgresql. Tested on Linux w/ Python 3.9-3.13 & Postgres 13-17.
66

77
Testing is underway for supporting Python 3.13 and is expected in v3.1. Newest versions of major linux distro's (Debian 12, Ubuntu 24.04 & EL10) are all still using Python 3.12 so sticking with using 3.12 is advised in the short run.
88

@@ -132,6 +132,15 @@ In your running instance of Postgres from the PSQL command line
132132
CREATE EXTENSION multicorn;
133133
```
134134

135+
## Known Issues
136+
137+
### PL/Python
138+
139+
multicorn2 and PL/Python are incompatible with each other as-of Python 3.12. Due to internal [technical limitations](https://github.com/pgsql-io/multicorn2/issues/60), both systems cannot be used simultaneously within the same PostgreSQL database.
140+
141+
However, both can be installed on the same system without conflict. Since PL/Python is commonly installed by default in packaged PostgreSQL distributions, multicorn2 can still be installed and used when PL/Python is not actively being used.
142+
143+
135144
## Integration tests
136145

137146
multicorn2 has an extensive suite of integration tests which run against live PostgreSQL servers. In order to manage the matrix of supported versions of Python and PostgreSQL, the Nix package manager can be used to provide all the dependencies and run all the tests. The Nix package manager is supported on Linux, MacOS, and Windows Subsystem for Linux. To install Nix, follow the instructions at https://nixos.org/download/.
@@ -150,9 +159,6 @@ To run a faster test suite against a specific version of Python and PostgreSQL,
150159
nix build .#testSuites.test_pg13_py39
151160
```
152161

153-
**Known issues:**
154-
- The tests cover the supported range of Python & PostgreSQL combinations;
155-
156162
### Adding new Python or PostgreSQL versions to the test suite
157163

158164
1. Perform a `nix flake update` in order to provide access to the latest packages available from the Nix package manager.

flake.nix

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
# python39 # end of security support is scheduled for 2025-10-31; therefore nixpkgs support was dropped before nixos 25.05 was released
2626
# python310 # error: sphinx-8.2.3 not supported for interpreter python3.10
2727
python311
28-
# python312 # tests are currently broken where plpython3u is used -- https://github.com/pgsql-io/multicorn2/issues/60
29-
# python313 # tests are currently broken where plpython3u is used -- https://github.com/pgsql-io/multicorn2/issues/60
28+
python312
29+
python313
3030
];
3131
testPostgresVersions = with pkgs; [
3232
postgresql_13
@@ -126,15 +126,15 @@
126126
# "# -> Build order", so to speak... structed to build up a PostgreSQL with a compatible Python interpreter that
127127
# is already configured to load the multicorn module.
128128
#
129-
# 1. Multicorn python package first, using the "raw" Python & "raw" PostgreSQL
129+
# 1. PostgreSQL w/ plpython3, using "raw" Python
130+
pythonEnabledPostgres = (makePostgresWithPlPython test_python test_postgresql);
131+
132+
# 2. Multicorn python package first, using the "raw" Python & "raw" PostgreSQL
130133
multicornPython = (makeMulticornPythonPackage test_python test_postgresql);
131134

132-
# 2. Python enhanced w/ the multicorn package
135+
# 3. Python enhanced w/ the multicorn package
133136
enhancedPython = (test_python.withPackages (ps: [multicornPython] ++ (requiredPythonPackages ps) ));
134137

135-
# 3. PostgreSQL w/ plpython3, using "enhanced" Python
136-
pythonEnabledPostgres = (makePostgresWithPlPython enhancedPython test_postgresql);
137-
138138
# 4. Multicorn postgresql extension, using the "enhanced" Python & plpython3 PostgreSQL
139139
multicornPostgresExtension = (makeMulticornPostgresExtension enhancedPython pythonEnabledPostgres);
140140

@@ -145,7 +145,11 @@
145145
]);
146146

147147
pgMajorVersion = pkgs.lib.versions.major test_postgresql.version;
148-
expectedTestCount = if pkgs.lib.versionOlder pgMajorVersion "14" then "18" else "19";
148+
pythonVersion = pkgs.lib.versions.majorMinor test_python.version;
149+
isPython312OrHigher = pkgs.lib.versionAtLeast pythonVersion "3.12";
150+
151+
baseTestCount = if pkgs.lib.versionOlder pgMajorVersion "14" then 18 else 19;
152+
expectedTestCount = toString (baseTestCount - (if isPython312OrHigher then 1 else 0));
149153
in pkgs.stdenv.mkDerivation {
150154
name = "multicorn2-python-test-pg${test_postgresql.version}-py${test_python.version}";
151155

0 commit comments

Comments
 (0)