Re: prepare in a do loop

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Marc Millas <marc(dot)millas(at)mokadb(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: prepare in a do loop
Date: 2021-02-15 16:23:26
Message-ID: CAKFQuwZa0jKc9ipDv-uKo2ZWwUvov6o_dvuw2ynTWpJDiax-rQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 15, 2021 at 9:19 AM Marc Millas <marc(dot)millas(at)mokadb(dot)com> wrote:

>
> postgres=# prepare moninsert(varchar) as
>
> do $$ begin for counter in 1..1000000 loop execute
> moninsert(randname());end loop;end;$$;
> ERREUR: la fonction moninsert(character varying) n'existe pas
> someone can explain ?
>
>
From the pl/pgsql docs:

"The PL/pgSQL EXECUTE statement is not related to the EXECUTE SQL statement
supported by the PostgreSQL server. The server's EXECUTE statement cannot
be used directly within PL/pgSQL functions (and is not needed)."

https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2021-02-15 16:23:29 Re: ADD FOREIGN KEY fails, but the records exist
Previous Message Adrian Klaver 2021-02-15 16:23:12 Re: prepare in a do loop