Christoph Berg wrote:
> > I don't quite see how to work around that, short of simply
> > removing the possibility of addressing columns by their
> > numbers. [...]
> That would be bad news, given that \crosstabview is meant for
> interactive use where these number shortcuts are much more likely to
> be used than in proper production SQL code. Be it only for ease of
> typing, or for the case where the columns are just called ?column?.
Ah, that reminds me that there's another corner case.
In a resultset, two columns can share the exact same name.
I think the only way to distinguish them in that case is
to refer to them by position, so that's another argument
to not discard that possibility.
=# select 'X' as "a", 'Y' as "a", 'Z' \crosstabview a a
Ambiguous column name: a
versus
=# select 'X' as "a", 'Y' as "a", 'x' \crosstabview 1 2a | Y
---+---X | x
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite