From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | ceharris(at)vt(dot)edu |
Cc: | pgsql-docs(at)lists(dot)postgresql(dot)org |
Subject: | Re: WITH RECURSIVE (Documentation section 7.8.1) Note |
Date: | 2019-10-02 16:41:44 |
Message-ID: | 9803.1570034504@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
PG Doc comments form <noreply(at)postgresql(dot)org> writes:
> In section 7.8.1, the author comments "Note: Strictly speaking, this process
> is iteration not recursion, but RECURSIVE is the terminology chosen by the
> SQL standards committee."
I think I'm to blame for that wording.
> Example: R_2 = F(F(R_0))
> Example: R_5 = F(F(F(F(F(R_0))))
> This is textbook recursion, not just some folly of the ANSI standards
> committee as suggested by the note in the text.
No, it isn't. F() is being applied repeatedly (iteratively). If F()
called itself internally, that would be recursion.
Another way to look at this is that control of whether the repetition
is finished is external to the function/query. If the stop condition
were part of the query logic, it'd be more sensible to think of it as
recursion, IMO.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2019-10-02 19:04:55 | Re: I'm surprised to see the word master here |
Previous Message | PG Doc comments form | 2019-10-02 15:58:52 | Pls mention ERROR: 2D000: cannot commit while a subtransaction is active on this page |