Skip to content

Boolean renders as smallint #161

@windiana42

Description

@windiana42

I am not sure this is intentional rendering of sqlalchemy.Boolean():

str(sqa.Boolean())
'BOOLEAN'
str(sqa.Boolean().compile(engine.dialect))
'SMALLINT'

My assumption would be that boolean is either a new or not that well supported type of DB2 LUW. This is why SMALLINT might have been a legacy fix for that problem.

Btw., I discovered a quite serious bug in DB2 container image (icr.io/db2_community/db2) with boolean:

DROP TABLE IF EXISTS tmp01;
CREATE TABLE tmp01
(
    col1 BIGINT,
    col2 BIGINT,
    col3 BIGINT,
    col4 BIGINT
);

INSERT INTO tmp01 values (2, 1, 2, 33);

SELECT
       df4.col3 * 4 >= df4.col4                          AS y,
       df4.col1 <= df4.col2 AND df4.col3 * 4 >= df4.col4 AS z
FROM tmp01 AS df4;

This yields y=NULL probably due to common subexpression between y and z and fast path evaluation of z.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions