Skip to content

SELECT * EXCLUDE(...) silently returns empty rows when all columns are excluded #21258

@xiedeyantu

Description

@xiedeyantu

Describe the bug

When using SELECT * EXCLUDE(col1, col2) and the excluded columns cover all columns in the table, DataFusion silently executes the query and returns rows with no columns instead of raising a planning error.

To Reproduce

create table t(a int, b int);
insert into t values (1,2),(3,4);
select * exclude(a, b) from t;
++
++
++
2 row(s) fetched.

Expected behavior

The query should fail at planning time with a clear error message, since the SELECT list is empty after wildcard expansion:
DataFusion error: Error during planning: SELECT list is empty after resolving * expressions, the wildcard expanded to zero columns. This behavior is consistent with DuckDB.

duckdb> create table t(a int, b int);
   ...> insert into t values (1,2),(3,4);
   ...> 
   ...> select * exclude(a, b) from t;
Binder Error: SELECT list is empty after resolving * expressions!

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions