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

Conversion from '{}'::unknown to empty list considered harmful #506

dvarrazzo opened this Issue Feb 7, 2017 · 1 comment


None yet
1 participant
Copy link

dvarrazzo commented Feb 7, 2017

Postgres 10 will not return "unknown" from queries, but will convert everything to text.

psycopg has a special case for which '{}'::unknown is converted into an empty list: this allows cur.execute("select %s", (L,)) to return back L whether it is empty or not. However this is a bit of a stretch: usually lists returned from a query will have a type attached, enough to tell psycopg to return a python list.

Here the discussion on -hackers.

As such psycopg 2.7 will not perform the cast anymore.

@dvarrazzo dvarrazzo added this to the psycopg 2.7 milestone Feb 7, 2017


This comment has been minimized.

Copy link

dvarrazzo commented Feb 7, 2017

Note: we started converting '{}'::unknown into an empty list after the problems reported in #42.

The change to revert is part of what proposed by @BenjaminPoulain, but the problematic behaviour was probably the opposite one: converting an empty Python list to '{}'::text[], which was already fixed in c1fe0b6 and not included in 5ee6057.

dvarrazzo added a commit that referenced this issue Feb 7, 2017

@dvarrazzo dvarrazzo closed this in 3e12522 Feb 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment