Skip to content

Cannot use COLUMNS('regexp') in window function? #17153

@wuxunfeng666

Description

@wuxunfeng666

What happens?

I have a grade table with multiple columns representing scores for different subjects.
I want to compute the ranking for each student in every subject in bulk and rename the resulting column to ${subject}_rank.
However, when I tried the following SQL, DuckDB throws an error:

Parser Error:
Cannot ORDER BY ALL in a window expression

To Reproduce

SELECT
    rank() OVER (ORDER BY COLUMNS('^(.*)_score$') DESC) AS '\1_rank'
FROM (
    SELECT 100 AS math_score)

OS:

Ubuntu 24.04, x86_64

DuckDB Version:

v1.3.0-dev2485 f2de8fd

DuckDB Client:

CLI

Hardware:

No response

Full Name:

Xunfeng Wu

Affiliation:

hobbyist

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

I have tested with a nightly 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