﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34772	Exception with psycopg3 binary package on Ubuntu 20.04	goffioul	nobody	"After upgrading my app to django-4.2.4, I attempted to upgrade to psycopg3 (3.1.10) using the binary package on my Ubuntu 20.04 server. I installed psycopg3 with pip using `pip install psycopg[binary]`. But the app then started to throw exceptions in various views, in particular in form views during rendering of a related field (list views seem fine, as well we form views without a related field):
{{{
NotSupportedError at [snip]/units/new/

server-side cursors not supported in pipeline mode
}}}

The last entry in the backtrace is as follows:
{{{
[snip]/lib/python3.8/site-packages/psycopg/server_cursor.py, line 286, in execute
            raise e.NotSupportedError( …
Local vars
Variable	Value
binary	None
kwargs	{}
params	()
query	('SELECT ""config_networkprofile"".""id"", ""config_networkprofile"".""name"", '
	 '""config_networkprofile"".""primaryVoip"", '
	 '""config_networkprofile"".""primarySipProxy"" FROM ""config_networkprofile"" ORDER '
	 'BY ""config_networkprofile"".""name"" ASC')
self	Error in formatting: ValueError: 32653 is not a valid PipelineStatus
}}}

What cauth my attention is the formatting error due to invalid/unexpected PipelineStatus value. As this is precompiled binary, I figured this might be due to some ABI incompatibility. I tried pure-python (""psycopg"") and local-install (""psycopg[c]"") and they both work fine, no exception is thrown. I also don't get any exception if I disable server-side cursors with `DISABLE_SERVER_SIDE_CURSORS`. 

Things that I think are relevant:
- my database uses defaults for ATOMIC_REQUESTS (False) and AUTOCOMMIT (True)
- I don't use transaction pooling, as mentioned in django docs
- I've reported the issue to psycopg project, but they appear to think the problem is on django side and closed the ticket (https://github.com/psycopg/psycopg/issues/622)
- I've also tried to use `server_side_binding`, as suggested in the forum, but that didn't help (https://forum.djangoproject.com/t/error-problem-with-psycopg3-and-server-side-cursors/22964)"	Uncategorized	closed	Database layer (models, ORM)	4.2	Normal	invalid			Unreviewed	0	0	0	0	0	0
