Search Postgresql Archives

Re: prepare in a do loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 moninsert(randname()) in plpgsql where moninsert was a PREPARE statement. In plpgsql EXECUTE is something different so it does not recognize moninsert(randname()) as a prepared statement and fails.



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, and the same thing within a do loop is plpgsql
so
postgres=# create function testexec()returns void as $$
postgres$# execute moninsert(randname());
postgres$# end;
postgres$# $$ language plpgsql;
ERREUR:  erreur de syntaxe sur ou près de « execute »
LIGNE 2 : execute moninsert(randname());
fine, quite coherent.
then




--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux