Tom Lane wrote:
If I'm reading the spec correctly, VALUES is exactly parallel to SELECT
in the grammar, which means that to use it in FROM you would need
parentheses and an alias:

        SELECT ... FROM (SELECT ...) AS foo

        SELECT ... FROM (VALUES ...) AS foo

One of the things I'm struggling with is lack of column aliases. Would it be reasonable to require something like this?

        SELECT ... FROM (VALUES ...) AS foo(col1, col2, ...)

The other issue is how to determine column type. Even better would be to require (similar to SRF returning record):

        SELECT ... FROM (VALUES ...) AS foo(col1 type1, col2 type2, ...)

This would unambiguously identify the column aliases and types. Assuming we stick with the spec:
        SELECT ... FROM (VALUES ...) AS foo

1. How should we assign column names?
     values1, values2, ...?
   or
     col1, col2, ...?
   or
     ???

2. How should we assign datatypes? Use the first "row" and try to coerce
   the rest to that type?

Joe

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to