Skip to content

Literal in SELECT DISTINCT ON clause raises ORDER BY non-integer literal has no effect. #14212

@wadinj

Description

@wadinj

What happens?

After upgrading to DuckDB 1.1.1, I encountered an issue where DuckDB raises Binder Error: ORDER BY non-integer literal has no effect when having literal in SELECT DISTINCT ON (..) clause.

Turning order_by_non_integer_literal=true resolves the issue, allowing literal in DISTINCT ON.

The error message is really confusing as the initial cause does not come from the ORDER BY clause.

I would rather accept literal in SELECT DISTINCT clause by default or rework the error message to point out the correct SQL clause.

To Reproduce

con = duckdb.connect(":memory:")
con.execute('CREATE TABLE my_table AS SELECT 42 AS "column_name";')
con.execute("SET order_by_non_integer_literal = true;")
con.execute(
    "SELECT DISTINCT ON (my_table.column_name, 'co2') my_table.column_name FROM my_table"
).fetchone()

OS:

iOS/Linux

DuckDB Version:

1.1.1

DuckDB Client:

Python

Hardware:

No response

Full Name:

Jonathan Wadin

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions