'x' is a table alias, not a column alias. There are some very limited circumstances in which a table alias applied to a table with an anonymous column causes the anonymous column to be renamed. Evidently those circumstances apply to case 1 but not case 2.
On Fri, Apr 29, 2022 at 8:51 AM Dmitry Sysolyatin <dm.sysolya...@gmail.com> wrote: > > Hi! > Maybe someone knows what can be the cause of the following issue: > > I tried to execute two queries: > val query1 = "SELECT x FROM unnest(array[1]) x" > val query2 = "SELECT x FROM unnest(array(select 1)) x" > > The first one works, but the second one throws an exception: > Column 'x' not found in any table