Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Values list-of-targetlists patch for comments (was Re: [PATCHES]
Date
Msg-id 44CC0A66.6070903@joeconway.com
Whole thread Raw
In response to 8.2 features?  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] 8.2 features?)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] 8.2 features?)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Do we need multiple forms of the SQL2003 statistics
Next
From: Tom Lane
Date:
Subject: Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] 8.2 features?)