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

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chris(dot)kings-lynne(at)calorieking(dot)com>, "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Bernd Helmle <mailings(at)oopsware(dot)de>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Susanne Ebrecht <susanne(dot)ebrecht(at)credativ(dot)de>
Subject: Re: Values list-of-targetlists patch for comments (was Re: [PATCHES]
Date: 2006-07-30 01:24:54
Message-ID: 44CC0A66.6070903@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers pgsql-patches

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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2006-07-30 01:27:20 Re: [HACKERS] 8.2 features?
Previous Message Bruce Momjian 2006-07-29 17:36:27 Re: Maintenance and External Projects (try 2)

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-07-30 01:27:20 Re: [HACKERS] 8.2 features?
Previous Message Greg Sabino Mullane 2006-07-30 01:14:16 New variable server_version_num

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-07-30 01:27:20 Re: [HACKERS] 8.2 features?
Previous Message Greg Sabino Mullane 2006-07-30 01:14:16 New variable server_version_num