Skip to content

this.<name>` resolves to the source relation instead of a same-named colum #6065

Description

@lukapeschke

What happened?

Related to #6020 . When a column has the same name as a relation, referencing it resolves to the source table instead of the columns.

In a sort, this causes the compilation to fail. In a select, it results in a wildcard select

PRQL input

# Sort case
from status | sort {this.status}

# Select case
from status | select {this.status}

SQL output

# Sort case
from `status` | sort {this.`status`}
                      ──────┬──────
                            ╰──────── table instance cannot be referenced directly

# Select case
SELECT
  *
FROM
  status

Expected SQL output

# Sort case
SELECT * FROM status ORDER BY status.status

# Select case
SELECT status FROM status

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

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions