[Sqlalchemy-tickets] Issue #3806: Postgres code generation is wrong for -> operator (HSTORE column
Brought to you by:
zzzeek
From: lincolnq <iss...@bi...> - 2016-09-27 11:26:37
|
New issue 3806: Postgres code generation is wrong for -> operator (HSTORE column access) pre-psql-9.5 https://bitbucket.org/zzzeek/sqlalchemy/issues/3806/postgres-code-generation-is-wrong-for lincolnq: On sqlalchemy 1.0.15, the below test code outputs "(test -> %(test_1)s) IS NOT NULL". On sqlalchemy 1.1.0b3, it outputs "test -> %(test_1)s IS NOT NULL" -- note the omitted parentheses. The latter code is correct in Postgres 9.5 and above where the IS NOT NULL operator has lower precedence than ->, but below 9.5, the IS NOT NULL operator's precedence is higher than the -> operator but sqlalchemy still thinks it is lower. ``` #!python from sqlalchemy import Column from sqlalchemy.dialects import postgresql col = Column(postgresql.HSTORE, name='test', primary_key=True) print(str((col['key'] != None).compile(dialect=postgresql.dialect()))) ``` |