Skip to content

Error when inserting boolean values #208

@bpastukh

Description

@bpastukh

Hi, i'm facing following exception when executing insert with bool value when columns is of UInt8 type after upgrading to v1.5.2.
After debug i've noticed that false is converted to 'false'.

In Statement.php line 183:

[ClickHouseDB\Exception\QueryException (400)]
HttpCode:400 ; ;Code: 6, e.displayText() = DB::Exception: Cannot parse string 'false' as UInt8: syntax error at begin of string. Note: there are toUInt8OrZero and toUInt8OrNull functions, which returns zer
o/NULL instead of throwing exception.: while executing 'FUNCTION CAST(assumeNotNull(_dummy_0) :: 2, 'UInt8' :: 1) -> cast(assumeNotNull(_dummy_0), 'UInt8') UInt8 : 4' (version 21.2.5.5 (official build))

Same problem is with Bool type (Type bool is internally stored as UInt8.) https://clickhouse.com/docs/en/sql-reference/data-types/boolean.

I suspect this commit to be the reason of the problem c8c9006

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