Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2009-01-08 Thread Bruce Momjian
Added to TODO: Add support for WITH RECURSIVE ... CYCLE * http://archives.postgresql.org/pgsql-hackers/2008-10/msg00291.php --- Tom Lane wrote: I looked a bit at the SQL:2008 spec for a CYCLE clause for WITH

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-14 Thread David Fetter
On Mon, Oct 13, 2008 at 07:01:29PM -0400, Tom Lane wrote: Merlin Moncure [EMAIL PROTECTED] writes: On Mon, Oct 13, 2008 at 9:56 AM, Tom Lane [EMAIL PROTECTED] wrote: I'm inclined to apply the patch with binary-coercibility adjustments and not try to turn RECORD or RECORD[] into

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-14 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: Here is another use-case solved by the patch. Previously, there was no easy way to index on a composite function result. The following works in HEAD: create function func(f foo, a out int, b out int) returns record ... create index foo_idx on

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-14 Thread Merlin Moncure
On Mon, Oct 13, 2008 at 7:01 PM, Tom Lane [EMAIL PROTECTED] wrote: Merlin Moncure [EMAIL PROTECTED] writes: On Mon, Oct 13, 2008 at 9:56 AM, Tom Lane [EMAIL PROTECTED] wrote: I'm inclined to apply the patch with binary-coercibility adjustments and not try to turn RECORD or RECORD[] into

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-14 Thread Merlin Moncure
On Tue, Oct 14, 2008 at 10:59 AM, Tom Lane [EMAIL PROTECTED] wrote: Merlin Moncure [EMAIL PROTECTED] writes: Here is another use-case solved by the patch. Previously, there was no easy way to index on a composite function result. The following works in HEAD: create function func(f foo, a

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-13 Thread Merlin Moncure
On Wed, Oct 8, 2008 at 4:27 PM, Tom Lane [EMAIL PROTECTED] wrote: Merlin Moncure [EMAIL PROTECTED] writes: On Tue, Oct 7, 2008 at 9:58 PM, Tom Lane [EMAIL PROTECTED] wrote: * Instead of the above, we could try to make ROW(some columns) = ANY (array variable) work. This is shorter than the

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-13 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: The record ops work as promised. IMO this patch stands in its own merits with or without the CTE changes. I played around with it and noticed a couple of oddities: select foo = foo from foo; --works but select distinct foo from foo; --yields

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-13 Thread Tom Lane
I wrote: Merlin Moncure [EMAIL PROTECTED] writes: select foo from foo order by foo; ERROR: could not identify an ordering operator for type foo Yeah, these are because of the incomplete handling of named record types. I'm not sure how far we want to go in that direction. On looking

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-13 Thread Merlin Moncure
On Mon, Oct 13, 2008 at 9:56 AM, Tom Lane [EMAIL PROTECTED] wrote: I wrote: Merlin Moncure [EMAIL PROTECTED] writes: select foo from foo order by foo; ERROR: could not identify an ordering operator for type foo Yeah, these are because of the incomplete handling of named record types. I'm

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-13 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: On Mon, Oct 13, 2008 at 9:56 AM, Tom Lane [EMAIL PROTECTED] wrote: I'm inclined to apply the patch with binary-coercibility adjustments and not try to turn RECORD or RECORD[] into full-fledged polymorphic types. It's not immediately clear what the use

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-13 Thread Alvaro Herrera
Tom Lane escribió: Merlin Moncure [EMAIL PROTECTED] writes: On Mon, Oct 13, 2008 at 9:56 AM, Tom Lane [EMAIL PROTECTED] wrote: I'm inclined to apply the patch with binary-coercibility adjustments and not try to turn RECORD or RECORD[] into full-fledged polymorphic types. It's not

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-08 Thread Merlin Moncure
On Tue, Oct 7, 2008 at 9:58 PM, Tom Lane [EMAIL PROTECTED] wrote: * Instead of the above, we could try to make ROW(some columns) = ANY (array variable) work. This is shorter than the above syntax and would presumably have a lot less overhead too. But it doesn't work right now, not

Re: [HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-08 Thread Tom Lane
Merlin Moncure [EMAIL PROTECTED] writes: On Tue, Oct 7, 2008 at 9:58 PM, Tom Lane [EMAIL PROTECTED] wrote: * Instead of the above, we could try to make ROW(some columns) = ANY (array variable) work. This is shorter than the above syntax and would presumably have a lot less overhead too. But

[HACKERS] WITH RECURSIVE ... CYCLE in vanilla SQL: issues with arrays of rows

2008-10-07 Thread Tom Lane
I looked a bit at the SQL:2008 spec for a CYCLE clause for WITH RECURSIVE. It is interesting to see that it is just syntactic sugar, because *they spell out how to expand it into regular SQL*. More, they defined it in such a way that it's hard to optimize at all, because the path column is