Hi,

If the main motivation is better completion, with compatibility with
DuckDB and ClickHouse as an additional benefit, v1 seems like the
better choice.

With v1, FROM establishes the relation scope before SELECT, allowing
psql to complete input columns. The select list then defines output
aliases before GROUP BY and ORDER BY, where PostgreSQL permits those
aliases. This gives us another useful completion opportunity. v2 loses
this property for GROUP BY.

v1 also matches the existing FROM-first syntax in DuckDB and
ClickHouse.

I think we should also test completion with JOINs: multiple relations,
table aliases, qualified columns, ON/USING, and target-list columns
from both sides. The current rules seem mostly centered on a single
relation.


Best regards,
Denis Smirnov



Reply via email to