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

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(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 17:27:45
Message-ID: CAHOFxGonSvqwT=MHJQZ=jbmVg+BqpAYj5vfJos3y96R9bHc97w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-10-25 17:33:38 Re: Quere keep using temporary files
Previous Message rihad 2019-10-25 15:56:26 Re: Quere keep using temporary files