]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
resolve select to NULLTYPE if no columns
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 7 Mar 2023 14:03:07 +0000 (09:03 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 7 Mar 2023 14:03:07 +0000 (09:03 -0500)
commitb97b313c6eb7f2fe4b98d011c292de4d258c508c
treee33b8abe85827a7d48df8e4f7e2f79ed97dd0b26
parentdccc4577fec202947adac8da43d40f415433cf6b
resolve select to NULLTYPE if no columns

Fixed regression where the :func:`_sql.select` construct would not be able
to render if it were given no columns and then used in the context of an
EXISTS, raising an internal exception instead. While an empty "SELECT" is
not typically valid SQL, in the context of EXISTS databases such as
PostgreSQL allow it, and in any case the condition now no longer raises
an internal exception.

For this case, also add an extra whitespace trim step for the unusual
case that there are no columns to render.  This is done in such a
way as to not interfere with other test cases that are involving
custom compilation schemes.

Fixes: #9440
Change-Id: If65ba9ce15d371f09b4342ad0669143b7b082a78
doc/build/changelog/unreleased_20/9440.rst [new file with mode: 0644]
lib/sqlalchemy/sql/compiler.py
lib/sqlalchemy/sql/selectable.py
test/sql/test_select.py