Skip to content

[Bug]: 'NoneType' object is not iterable when using COUNT(*) with IN clause* #12366

@Kray-lab

Description

@Kray-lab

Short description of current behavior

GOT:Error: 'NoneType' object is not iterable

Connect a data source containing tables with Chinese table/column names.
Ask a question to Data Agent where executing the following SQL:
SELECT COUNT(*) AS total_count
FROM mindsdb.设备
WHERE 零件 = 'A1'
AND 编码 IN ('B1','B2','B3','B4','B5');

Video or screenshots

Error: 'NoneType' object is not iterable

Expected behavior

The query should return the count of matching records.

How to reproduce the error

Connect a data source containing tables with Chinese table/column names.
Execute the following SQL:
SELECT COUNT(*) AS total_count
FROM mindsdb.设备
WHERE 零件 = 'A1'
AND 编码 IN ('B1','B2','B3','B4','B5');

Anything else?

Environment
Product: MindsDB
Interface: SQL Editor / Agent SQL Query

SELECT * with the same WHERE condition (without IN) returns data correctly.
SELECT DISTINCT queries work as expected.
The 编码 column contains NULL values, but the filter = 'A1' should not be affected.
The issue appears to be related to the combination of the COUNT(*) aggregate function and the IN clause.
Tables and columns use non-ASCII (Chinese) names, which may be a contributing factor.

Blocks aggregate queries on filtered datasets, but can be worked around at the application level.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions