Code review comment for lp:~lifeless/storm/with

Revision history for this message
James Henstridge (jamesh) wrote :

@niemeyer
> Please note that I wasn't suggesting using aliases. We might simply not get
> into the business of defining the query in detail, in a way similar to how
> we don't detail how the CREATE TABLE is run with its column names.

While we don't really need to care about ordering or uniqueness of names for table definitions, I'm not sure that carries over to this feature. At the most basic level the WITH query will generate tuples of values, and we need names for those values in the outer query.

While we can rely on default naming in some cases, in others it is less clear. Take the following, for instance:

WITH company_employee AS (
  SELECT company.name, employee.name FROM company, employee WHERE company.id = employee.company_id)
SELECT company_employee.name FROM company_employee

What will company_employee.name refer to? What is the name of the other column? That's why I think it would be more robust to always give a column name list.

« Back to merge proposal