Re: Error check always bypassed in tablefunc.c - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Error check always bypassed in tablefunc.c
Date
Msg-id CAB7nPqQ4rxrkt2+nud_3cgQGztDJXx=CXNSEEQCs8Bb3q64kKA@mail.gmail.com
Whole thread Raw
In response to Re: Error check always bypassed in tablefunc.c  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On Tue, Jan 20, 2015 at 4:05 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> On Tue, Jan 20, 2015 at 8:47 AM, Michael Paquier
> <michael.paquier@gmail.com> wrote:
>> On Mon, Jan 19, 2015 at 11:06 PM, Joe Conway <mail@joeconway.com> wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> On 01/19/2015 08:16 AM, Alvaro Herrera wrote:
>>>> Haven't looked at this patch, but I wonder if it would be better
>>>> to replace the innards of connectby with a rewrite of the query to
>>>> use standard WITH queries.  Maybe we can remove a couple hundred
>>>> lines from tablefunc.c?
>>>
>>> Seems like a good idea -- connectby is really obsolete for quite a
>>> while now other than as an SRF example. I guess we only keep it around
>>> for backwards compatibility?
>> For master, yes we could brush up things a bit. Now do we really do
>> the same for back-branches? I would think that the answer there is
>> something close to the patch I sent.
>
> So, using a WITH RECURSIVE, here is a query equivalent to what connectby does:
> [...]
> Thoughts?
Looking at this stuff, actually I do not think that it is possible for
now to support orderby_fld at the same level with WITH RECURSIVE in
connectby because we need to reorder the items of the base table
within the 2nd query of the UNION ALL to give something like that and
WITH RECURSIVE does not support ORDER BY (and mutual recursion between
WITH items).

Another thing to note is that WITH RECURSIVE weakens the infinite
recursion detection. I don't think it would be good to weaken that...
Attached is a result of this random hacking, resulting in some cleanup
btw:
 1 file changed, 110 insertions(+), 264 deletions(-)
Regards,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Abhijit Menon-Sen
Date:
Subject: Re: pgaudit - an auditing extension for PostgreSQL
Next
From: Andrew Gierth
Date:
Subject: Re: B-Tree support function number 3 (strxfrm() optimization)