Skip to content

Invalid DISTINCT ON clause generated for postgresql #5556

@fredericp

Description

@fredericp

What happened?

prql version 0.13.7 generates invalid DISTINCT ON clause for postgresql. In this case it outputs: DISTINCT ON (id, name) that should be DISTINCT ON (id, name) *.

kudos for this great project!

PRQL input

from t1
group {t1.id, t1.name} (take 1)
aggregate {c=count this}

SQL output

WITH table_0 AS (
  SELECT
    DISTINCT ON (id, name)
  FROM
    t1
)
SELECT
  COUNT(*) AS c
FROM
  table_0

Expected SQL output

WITH table_0 AS (
  SELECT
    DISTINCT ON (id, name) *
  FROM
    t1
)
SELECT
  COUNT(*) AS c
FROM
  table_0

MVCE confirmation

  • Minimal example
  • New issue

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugInvalid compiler output or panic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions