Re: right way of using case-expressions in plpgsql functions

2023-10-15 Thread Victor Dobrovolsky
Thank you. I'll take it. пн, 16 окт. 2023 г. в 00:20, Ron : > On 10/15/23 11:19, Victor Dobrovolsky wrote: > > [snip] > > The documentation states that after some executions of such functions the > plan should become generic. > What is a generic plan for such a case and how would it work? > > > I

Re: right way of using case-expressions in plpgsql functions

2023-10-15 Thread Victor Dobrovolsky
>Yeah, that would probably be a preferable approach if you're hoping >for significantly different query plans for the two cases. Thank you. My goal is to find out some basic rules that could help me to navigate issues like this. Regarding generalized plans in general, and the use of the case-expre

Re: right way of using case-expressions in plpgsql functions

2023-10-15 Thread Tom Lane
Victor Dobrovolsky writes: > From that - "short and dirty translation" - point of view - should I prefer > to divide that > $$ > Select > case $1 > when '1'::numeric then tbl.p1 > when '2'::numeric then tbl.p2 > ... > end as cresult > $$ > expression into: > $$ > ... > if $1 = '1'::numeric then (

Re: right way of using case-expressions in plpgsql functions

2023-10-15 Thread Ron
On 10/15/23 11:19, Victor Dobrovolsky wrote: [snip] The documentation states that after some executions of such functions the plan should become generic. What is a generic plan for such a case and how would it work? It's highly dependent on the query When I see this happen (after we notice th

Re: right way of using case-expressions in plpgsql functions

2023-10-15 Thread Victor Dobrovolsky
First of all, thanks everyone for the answers. вс, 15 окт. 2023 г. в 20:08, Tom Lane : > "David G. Johnston" writes: > > On Sunday, October 15, 2023, Victor Dobrovolsky > > wrote: > >> select (case when px is not null then pf = px > >> else pf is not distinct from py > >> end); > > > Every sing

Re: right way of using case-expressions in plpgsql functions

2023-10-15 Thread Tom Lane
"David G. Johnston" writes: > On Sunday, October 15, 2023, Victor Dobrovolsky > wrote: >> select (case when px is not null then pf = px >> else pf is not distinct from py >> end); > Every single time this function is called “px is not null” will be > evaluated and then one of the two branches wi

Re: right way of using case-expressions in plpgsql functions

2023-10-15 Thread David G. Johnston
On Sunday, October 15, 2023, Victor Dobrovolsky wrote: > > select (case when px is not null then pf = px > else pf is not distinct from py > end); > > Every single time this function is called “px is not null” will be evaluated and then one of the two branches will be evaluated. Nothing

right way of using case-expressions in plpgsql functions

2023-10-15 Thread Victor Dobrovolsky
I understood from documentation that case expression can be 1) optimized by planner 2) may compute its subexpressions in advance, in case of presence aggregation functions in them, for example. The question is - how it is combined with generic prepared plans in pl/pgsql. How can I deduct - when us

Re: RPM-Sync complains about wrong checksums for SLES12 repo

2023-10-15 Thread Stefan Mayr
Hi Julien, Hi, On Sun, Oct 15, 2023 at 09:42:47AM +0200, Stefan Mayr wrote: Hello everyone, we try to mirror https://download.postgresql.org/pub/repos/zypp/12/suse/sles-12.5-x86_64/ using Uyuni (open source base for SUSE Manager) as a local repo management system. Uyuni complains about wrong

Re: RPM-Sync complains about wrong checksums for SLES12 repo

2023-10-15 Thread Julien Rouhaud
Hi, On Sun, Oct 15, 2023 at 09:42:47AM +0200, Stefan Mayr wrote: > Hello everyone, > > we try to mirror > https://download.postgresql.org/pub/repos/zypp/12/suse/sles-12.5-x86_64/ > using Uyuni (open source base for SUSE Manager) as a local repo management > system. Uyuni complains about wrong chec

RPM-Sync complains about wrong checksums for SLES12 repo

2023-10-15 Thread Stefan Mayr
Hello everyone, we try to mirror https://download.postgresql.org/pub/repos/zypp/12/suse/sles-12.5-x86_64/ using Uyuni (open source base for SUSE Manager) as a local repo management system. Uyuni complains about wrong checksums which is absolutly correct: the metadata in the repodata folder ha