Re: prepare in a do loop

2021-02-15 Thread Adrian Klaver
On 2/15/21 9:55 AM, Marc Millas wrote: Hi Tom, I do read the doc, and understand the caching behaviour of plpgsql. This is not about plpgsql caching. It is about EXECUTE in plpgsql meaning something different then the PREPARE/EXECUTE combination in SQL. You are trying to run EXECUTE moninse

Re: prepare in a do loop

2021-02-15 Thread Marc Millas
Hi Tom, I do read the doc, and understand the caching behaviour of plpgsql. if in psql I write begin;execute moninsert(randname()); execute moninsert(randname());end; it does work. And if I put this (begin execute end) inside a do loop it doesnt anymore. ok the begin execute end is ""pure"" SQL,

Re: prepare in a do loop

2021-02-15 Thread Tom Lane
Marc Millas writes: > in psql, with a postgres 12.5 db on a centos 7 intel: > I do create a function named randname() returning a varchar, and a table > matable with a column prenom varchar(50). then > postgres=# prepare moninsert(varchar) as > postgres-# insert into matable(prenoms) values($1); >

Re: prepare in a do loop

2021-02-15 Thread David G. Johnston
On Mon, Feb 15, 2021 at 9:19 AM Marc Millas wrote: > > postgres=# prepare moninsert(varchar) as > > do $$ begin for counter in 1..100 loop execute > moninsert(randname());end loop;end;$$; > ERREUR: la fonction moninsert(character varying) n'existe pas > someone can explain ? > > >From the pl

Re: prepare in a do loop

2021-02-15 Thread Adrian Klaver
On 2/15/21 8:18 AM, Marc Millas wrote: Hi, in psql, with a postgres 12.5 db on a centos 7 intel: I do create a function named randname() returning a varchar, and a table matable with a column prenom varchar(50). then postgres=# prepare moninsert(varchar) as postgres-# insert into matable(preno