Skip to content

BadGrammarException when the same alias is used within two different CTEs #4088

@pstobiecki-ocado

Description

@pstobiecki-ocado

For a query like this:

WITH
  abc AS (select 1 AS x),

  def AS (
    WITH
      abc AS (select 1 AS y)

    select * from abc
  )

select abc.x, def.y from abc, def

H2 in version 2.3.230 throws BadGrammarException because of the duplicate abc alias. H2 in version 2.2.224 does not, and accepts this query. The query seems to be correct by SQL standards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions