Skip to content

Apply Aggregate is broken #36

@ocharles

Description

@ocharles

Thanks to help from @tomjaguarpaw, I think I can finally conclude that Apply Aggregate won't work:

aggregate $ values [lit True, lit False] >>= \x -> pure ((x &&.) <$> Rel8.or x)

produces

SELECT
("values0_1") AND ("result0_2") as "anon"
FROM (SELECT
      *
      FROM (SELECT
            BOOL_OR("inner0_2") as "result0_2"
            FROM (SELECT
                  "values0_1" as "inner0_2",
                  *
                  FROM (SELECT
                        *
                        FROM (SELECT "column1" as "values0_1"
                              FROM
                              (VALUES
                               (CAST(TRUE AS bool)),
                               (CAST(FALSE AS bool))) as "V") as "T1") as "T1") as "T1"
            GROUP BY COALESCE(0)) as "T1") as "T1"

which errors with

ERROR:  column "values0_1" does not exist
LINE 2: ("values0_1") AND ("result0_2") as "anon"

There is a clear scoping violation in that query. When we had Applicative Aggregate with the traversal to group anything unaggregated this was OK, but then we found out you can't group arbitrary expressions (the type must have a notion equality).

I think we've reached the end of this exploration. Oh well!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions