From: | Aleš Zelený <zeleny(dot)ales(at)gmail(dot)com> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com> |
Cc: | "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: PostgreSQL 14.4 ERROR: out of memory issues |
Date: | 2022-08-05 15:47:02 |
Message-ID: | CAODqTUaEBP-6+t9P7h9tVQZJK84L2QQgpyz9XiXyF+FhjK-jkw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
the construct surprised me when I saw it in the function the first time,
but it is correct and works as expected - it allows writing the function as
SQL instead of PLPGSQL while it ensures that for a parameter null value it
evaluates to true instead of filtering the resultset.
What is the issue/better solution proposal?
Kind regards Ales Zeleny
čt 4. 8. 2022 v 23:15 odesílatel Joe Conway <mail(at)joeconway(dot)com> napsal:
> On 8/4/22 08:34, Aleš Zelený wrote:
> >> SELECT ... simple join of two tables...
> >> WHERE opd.id_data_provider = _id_data_provider
> >> AND CASE WHEN _external_id IS NULL
> >> THEN external_id IS NULL
> >> ELSE external_id = _external_id
> >> END
> >> AND CASE WHEN _external_complete_id IS NULL
> >> THEN _external_complete_id IS NULL
>
> Unrelated to your question, but shouldn't that actually read:
>
> AND CASE WHEN _external_complete_id IS NULL
> THEN external_complete_id IS NULL
> ^^^
>
> >> ELSE external_complete_id = _external_complete_id
> >> END;
> >> $function$
>
> --
> Joe Conway
> RDS Open Source Databases
> Amazon Web Services: https://aws.amazon.com
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter J. Holzer | 2022-08-06 08:25:59 | Re: PostgreSQL 14.4 ERROR: out of memory issues |
Previous Message | Danny Shemesh | 2022-08-05 09:50:53 | Expr. extended stats are skipped with equality operator |