use of singletons in 0.9 causes non-intuitive folding of constants

Issue #3170 resolved
Mike Bayer repo owner created an issue
from sqlalchemy import select, null

from sqlalchemy.sql.elements import Null

print select([null(), null()])

print select([Null(), Null()])
SELECT NULL AS anon_1
SELECT NULL AS anon_1, NULL AS anon_2

this is due to the singleton.

it's totally a regression, so this is critical that something is figured out.

Comments (4)

  1. Mike Bayer reporter

    interestingly, this is OK:

    stmt = select([None, None])
    

    I think we have to just get rid of the singleton

  2. Mike Bayer reporter
    • Reversing a change that was made in 0.9, the "singleton" nature of the "constants" :func:.null, :func:.true, and :func:.false has been reverted. These functions returning a "singleton" object had the effect that different instances would be treated as the same regardless of lexical use, which in particular would impact the rendering of the columns clause of a SELECT statement. fixes #3170

    → <<cset ade27f35cb49>>

  3. Log in to comment