Re: Problem with LATERAL

From: Eagna <eagna(at)protonmail(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Problem with LATERAL
Date: 2022-10-13 08:04:03
Message-ID: wlSYzEPIXpDDcXltpFyND7yNWiXJWBfnZaT7IU5ksn_x8p6CJiZVNFweIKE_EgKLb9asJfw5ruqKpg2jYGStLdSlxKbeo2huV8pmJRjlpAg=@protonmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> > ERROR: syntax error at or near "WHERE"
> > LINE 10: WHERE o.total_price > ISNULL(sub.paid, 0);


> There error here is because a JOIN clause requires a join condition. Adding an
> "ON true" is probably what you want. You would also need to change isnull()
> with coalesce().

> The final query should be:

...
...
...
> ) AS sub ON true
...
...

OK - I see that it works now - which is great!

However, it's unclear to me what, exactly, it is that is "TRUE"?

What am I joining to what?

The syntax is unclear to me - if I'm joining, I should be joining on tab_A.field_x = tab_B.field_y - no?

Why does SQL Server's OUTER APPLY not require this?

Thanks for any input - Merci, À+

Rgs,

E.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Julien Rouhaud 2022-10-13 08:34:13 Re: Problem with LATERAL
Previous Message Julien Rouhaud 2022-10-13 07:30:11 Re: Problem with LATERAL