I experience an issue when trying to connect to my local postgresql cluster. The error is :
File "/home/ludo/.virtualenvs/pyvt/lib/python3.6/site-packages/asyncpg/serverversion.py", line 49, in <listcomp>
versions = [int(p) for p in parts][:3]
ValueError: invalid literal for int() with base 10: '1 (Debian 10'
PostgreSQL version given by the server itself :
[ludo@postgres] # select version();
version
---------------------------------------------------------------------------------------------------------
PostgreSQL 10.1 (Debian 10.1-3) on x86_64-pc-linux-gnu, compiled by gcc (Debian 7.2.0-19) 7.2.0, 64-bit
(1 ligne)
PostgreSQL was installed from the main debian repositories :
apt-cache policy postgresql-10
postgresql-10:
Install茅聽: 10.1-3
Candidat聽: 10.1-3
Table de version聽:
*** 10.1-3 500
500 http://httpredir.debian.org/debian sid/main amd64 Packages
100 /var/lib/dpkg/status
I looked into the code but failed to find where the version is fetched from PG.
The version_string received in the split_server_version_string function is equal to "10.1 (Debian 10.1-3)" but it should be only "10.1" according to the rest of the function.
Any ideas to fix it ?
Sigh, arguably it's a Debian bug. There's no good reason why they should adulterate the PG_VERSION risking breakage like this. #251 has a workaround.
thanks for the quick fix.
For my understanding how do you retrieve the PG version ?
The version is reported by the server when the connection is established via a ParameterStatus protocol message.
It seems like this problem is now present in new/upgrades PostgreSQL databases on Heroku, so anyone running asyncpg on Heroku with a recent PostgreSQL version now needs to run asyncpg from master. It would be lovely to have a new release cut which includes this workaround.
Most helpful comment
It seems like this problem is now present in new/upgrades PostgreSQL databases on Heroku, so anyone running asyncpg on Heroku with a recent PostgreSQL version now needs to run asyncpg from master. It would be lovely to have a new release cut which includes this workaround.