Re: WITH RECURSIVE doesn't work properly for me

From: Jing Fan <fanjing09(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: WITH RECURSIVE doesn't work properly for me
Date: 2013-11-05 18:03:41
Message-ID: CA+BectnCMjSOY3KdUB4Wv18+ukDHrub4=B94yazbSUFBXTzWDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If the grouping inside CTE is executed, I don't think it would generate
result like

src_id | dest_id | dist
--------+---------+------
3384 | 6236 | 1
3384 | 1739 | 2
3384 | 6236 | 3
3384 | 1739 | 4
3384 | 6236 | 5
3384 | 1739 | 6
3384 | 6236 | 7
3384 | 1739 | 8
3384 | 6236 | 9
3384 | 1739 | 10
3384 | 6236 | 11

for we have min(dist),
so it should be like

src_id | dest_id | dist
--------+---------+------
3384 | 6236 | 1
3384 | 1739 | 2

other values will be eliminated by min(). It actually generate no new
tuples and the iteration should stop.

Best,
Jing

On Tue, Nov 5, 2013 at 9:28 AM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>wrote:

> Jing Fan wrote:
> > Why the one inside does not do anything? It won't be executed?
>
> It is executed.
>
> It might filter out the occasional row, but if you look at
> the example I gave you, you'll see that it won't do anything
> to keep it from recursing.
>
> Yours,
> Laurenz Albe
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Figueiredo Jr. 2013-11-05 18:24:58 Re: GSSAPI server side on Linux, SSPI client side on Windows
Previous Message Christian Ullrich 2013-11-05 17:35:55 Re: GSSAPI server side on Linux, SSPI client side on Windows