I am running a query with join from 2 tables having similarly named index "time". I want to return the result with the same named index "time".
SELECT "tbl1"."a" "a",
"tbl1"."b" "b",
"tbl2"."c" "c",
COALESCE("tbl"."time", "tb2"."time") "time"
FROM "tbl1"
FULL OUTER JOIN "tbl2"
ON "tbl1"."timestamp" =
"tbl2"."timestamp"
ORDER BY "time"
This query returns an error that "time" is redundant (in ORDER BY).
If I change alias "time" to something else - it will work. But I do want that query will return "time"
If I change ORDER BY to
ORDER BY COALESCE("tbl"."time", "tb2"."time")
It will also work, but as far as I understand it will do the search for Nones twice and extend execution time (isn't it?).