Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad poll state while using async connection with PGDATESTYLE set to sql,mdy #115

Open
nobleread opened this issue Apr 6, 2020 · 0 comments

Comments

@nobleread
Copy link

While asynchronously connecting to database, exception that indicates wrong poll state is thrown.

PGDATESTYLE env variable is set to "sql, mdy" which is correct value according to postgres documentation (8.5.2 of https://www.postgresql.org/docs/9.5/datatype-datetime.html).
It seems like this is the source of the problem. When PGDATESTYLE is set to "iso, mdy" psycopg2cffi works correctly.

test.py tries to connect (async) to database and execute "SELECT 1" on it.

[root@host121 pgtest]# (export PGDATESTYLE='iso, mdy';  pypy3 test.py )
start
wait connect
wait select
[(1,)]

[root@host121 pgtest]# (export PGDATESTYLE='sql, mdy';  pypy3 test.py )
start
wait connect
bad state from poll: 3

The exception throw is:

<class 'psycopg2cffi._impl.exceptions.OperationalError'>
Traceback (most recent call last):
  File "test.py", line 19, in <module>
    wait_select(aconn)
  File "/usr/local/pypy3/site-packages/psycopg2cffi-2.8.1-py3.6-linux-x86_64.egg/psycopg2cffi/extras.py", line 607, in wait_select
    raise conn.OperationalError("bad state from poll: %s" % state)
psycopg2cffi._impl.exceptions.OperationalError: bad state from poll: 3

While using normal psycopg2 implementation connection works as expected.

Let me know if I can provide more details.

MR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant