First of all congrats with 3.9 release.
I was waiting on select_as feature particularly. But after update it does not work (as i was expecting).
# old code:
query
|> select_merge([txn: t], %{
time:
fragment(
"DATE_TRUNC('day', ? AT TIME ZONE 'utc' AT TIME ZONE 'Europe/Riga')::date",
t.inserted_at
)
})
|> group_by(
[txn: t],
fragment(
"DATE_TRUNC('day', ? AT TIME ZONE 'utc' AT TIME ZONE 'Europe/Riga')::date",
t.inserted_at
)
)
# tried new code:
query
|> select_merge([txn: t], %{
time:
selected_as(fragment(
"DATE_TRUNC('day', ? AT TIME ZONE 'utc' AT TIME ZONE 'Europe/Riga')::date",
t.inserted_at
), :time)
})
|> group_by(selected_as(:time))
# error
invalid alias: `:time`. Use `selected_as/2` to define aliases in the outer most `select` expression.
if I understand correctly selected_as is not supported with select_merge. What was reasoning behind not allowing it? Some technical or philosophical limitations? Will it be supported in near future?
Thanks.