Re: Error check always bypassed in tablefunc.c

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error check always bypassed in tablefunc.c
Date: 2015-01-21 08:32:14
Message-ID: CAB7nPqQ4rxrkt2+nud_3cgQGztDJXx=CXNSEEQCs8Bb3q64kKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 20, 2015 at 4:05 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Tue, Jan 20, 2015 at 8:47 AM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> On Mon, Jan 19, 2015 at 11:06 PM, Joe Conway <mail(at)joeconway(dot)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 Content-Type Size
20150121_tablefunc_cleanup.patch text/x-patch 12.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2015-01-21 09:47:54 Re: B-Tree support function number 3 (strxfrm() optimization)
Previous Message Abhijit Menon-Sen 2015-01-21 08:04:04 Re: pgaudit - an auditing extension for PostgreSQL