Re: Proposing WITH ITERATIVE - Mailing list pgsql-hackers

From Jonah H. Harris
Subject Re: Proposing WITH ITERATIVE
Date
Msg-id CADUqk8UTAAsT_FQ85J2Xma9YbtA5y8f0SXyzpiWiR1_39ycfSw@mail.gmail.com
Whole thread Raw
In response to Re: Proposing WITH ITERATIVE  ("Jonah H. Harris" <jonah.harris@gmail.com>)
Responses Re: Proposing WITH ITERATIVE  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
On Wed, Apr 29, 2020 at 5:54 PM Jonah H. Harris <jonah.harris@gmail.com> wrote:
On Wed, Apr 29, 2020 at 4:50 PM Corey Huinker <corey.huinker@gmail.com> wrote:
Having both WHERE and WHILE might look awkward.

Maybe an UNTIL instead of WHILE?

While I'm not a huge fan of it, one of the other databases implementing this functionality does so using the syntax:

WITH ITERATIVE R AS '(' R0 ITERATE Ri UNTIL N (ITERATIONS | UPDATES) ')' Qf

Where N in ITERATIONS represents termination at an explicit count and, in UPDATES, represents termination after Ri updates more than n rows on table R.

Sent too soon :) One of the main reasons I dislike the above is that it assumes N is known. In some cases, however, you really need termination upon a condition.

-- 
Jonah H. Harris

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: xid wraparound danger due to INDEX_CLEANUP false
Next
From: Peter Geoghegan
Date:
Subject: Re: Fixes for two separate bugs in nbtree VACUUM's page deletion