Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-21 Thread Dean Rasheed
On 20 November 2013 22:46, Andrew Gierth and...@tao11.riddles.org.uk wrote: Tom == Tom Lane t...@sss.pgh.pa.us writes: Tom 1. Reinsert HEAD's prohibition against directly combining WITH Tom ORDINALITY with a coldeflist (with a better error message and a Tom HINT suggesting that you can get

Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-21 Thread Tom Lane
Dean Rasheed dean.a.rash...@gmail.com writes: On 20 November 2013 22:46, Andrew Gierth and...@tao11.riddles.org.uk wrote: Tom == Tom Lane t...@sss.pgh.pa.us writes: Tom 1. Reinsert HEAD's prohibition against directly combining WITH Tom ORDINALITY with a coldeflist (with a better error message

[HACKERS] WITH ORDINALITY versus column definition lists

2013-11-20 Thread Tom Lane
Consider the following case of a function that requires a column definition list (example borrowed from the regression tests): create function array_to_set(anyarray) returns setof record as $$ select i AS index, $1[i] AS value from generate_subscripts($1, 1) i $$ language sql strict immutable;

Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-20 Thread David Johnston
Tom Lane-2 wrote It seems to me that we don't really want this behavior of the coldeflist not including the ordinality column. It's operating as designed, maybe, but it's unexpected and confusing. We could either 1. Reinsert HEAD's prohibition against directly combining WITH ORDINALITY

Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-20 Thread Tom Lane
David Johnston pol...@yahoo.com writes: Tom Lane-2 wrote It seems to me that we don't really want this behavior of the coldeflist not including the ordinality column. It's operating as designed, maybe, but it's unexpected and confusing. We could either 1. Reinsert HEAD's prohibition

Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-20 Thread David Johnston
Tom Lane-2 wrote David Johnston lt; polobo@ gt; writes: Tom Lane-2 wrote It seems to me that we don't really want this behavior of the coldeflist not including the ordinality column. It's operating as designed, maybe, but it's unexpected and confusing. We could either 1. Reinsert

Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-20 Thread Tom Lane
David Johnston pol...@yahoo.com writes: Just to clarify we are still allowing simple aliasing: select * from generate_series(1,2) with ordinality as t(f1,f2); Right, that works (and is required by spec, I believe). It's what to do with our column-definition-list extension that's at issue.

Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-20 Thread David Johnston
Tom Lane-2 wrote David Johnston lt; polobo@ gt; writes: Just to clarify we are still allowing simple aliasing: select * from generate_series(1,2) with ordinality as t(f1,f2); Right, that works (and is required by spec, I believe). It's what to do with our column-definition-list

Re: [HACKERS] WITH ORDINALITY versus column definition lists

2013-11-20 Thread Andrew Gierth
Tom == Tom Lane t...@sss.pgh.pa.us writes: Tom 1. Reinsert HEAD's prohibition against directly combining WITH Tom ORDINALITY with a coldeflist (with a better error message and a Tom HINT suggesting that you can get what you want via the TABLE Tom syntax). That gets my vote. -- Andrew