Home > Software design >  Columns mixup in BigQuery is a bug or a feature?
Columns mixup in BigQuery is a bug or a feature?

Time:06-15

How is this:

WITH t AS (
  SELECT 
    'a' AS col_a,
    'b' AS col_b
)

SELECT 
  col_a -- missing comma passes validation
  col_b
FROM t

Results into this:

╔═══════╗
║ col_b ║
╠═══════╣
║ a     ║
╚═══════╝

Is this a bug or a feature?

CodePudding user response:

Not a bug, your main query means

SELECT col_a AS col_b FROM t;

col_a comes from table t and col_b is it's alias.

  • Related