Re: Trying to fetch records only if preceded by at least another one

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: Michael Lewis <mlewis(at)entrata(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Trying to fetch records only if preceded by at least another one
Date: 2019-10-25 20:19:55
Message-ID: CAADeyWge7DBSOvK3JNNbXDLyJfZBAJfYvFnrqYT_bMQV7Kx_Zg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you Michael -

On Fri, Oct 25, 2019 at 7:28 PM Michael Lewis <mlewis(at)entrata(dot)com> wrote:

> But it prints too many records: all moves cross-multiplied with each other.
>>
>> As if I have forgotten to add 1 more condition to the JOIN LATERAL
>>
>
> LIMIT 1 inside your lateral should resolve that. Personally, I'd move that
> condition to EXISTS condition inside WHERE clause instead. Just a style
> thing as far as I know.
>

How would you do that with EXISTS? I tried, but my query failed to compile

Regards
Alex

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Lewis 2019-10-25 22:39:12 Re: Trying to fetch records only if preceded by at least another one
Previous Message Michael Lewis 2019-10-25 18:57:57 Re: Composite type storage overhead