Re: Trying to dynamically create a procedure
От
Laurenz Albe
Тема
Re: Trying to dynamically create a procedure
Дата
Msg-id
948bd37078a5b45e101765f30bae25b651ca76f7.camel@cybertec.at
Ответ на
Trying to dynamically create a procedure (Dirschel, Steve)
Список
Дерево обсуждения
"permission denied to COPY to or from an external program" even with GRANT pg_execute_server_program Chema <chema@interneta.org>
Re: "permission denied to COPY to or from an external program" even with GRANT pg_execute_server_program Tom Lane <tgl@sss.pgh.pa.us>
Re: "permission denied to COPY to or from an external program" even with GRANT pg_execute_server_program "David G. Johnston" <david.g.johnston@gmail.com>
Re: "permission denied to COPY to or from an external program" even with GRANT pg_execute_server_program Chema <chema@interneta.org>
Trying to dynamically create a procedure "Dirschel, Steve" <steve.dirschel@thomsonreuters.com>
Re: Trying to dynamically create a procedure Christophe Pettus <xof@thebuild.com>
Re: Trying to dynamically create a procedure Laurenz Albe <laurenz.albe@cybertec.at>
On Wed, 2025-03-26 at 20:27 +0000, Dirschel, Steve wrote: > DO $$ > > BEGIN > > EXECUTE 'create or replace procedure junk.test_proc() ' || > 'LANGUAGE plpgsql ' || > 'AS $$ ' || > 'declare ' || > ' v_cnt integer := 0; ' || > 'begin ' || > ' raise notice 'v_cnt is %', v_cnt; ' || > 'end $$'; > > END; > > $$ > > It throws this error: > > ERROR: syntax error at or near "$$ > DO $$" > LINE 1: $$ > ^ > dbtest=> > dbtest=> END; > WARNING: there is no transaction in progress > COMMIT If you nest dollar quotes, you need to use different strings between the dollars: DO $do$ BEGIN EXECUTE 'CREATE PROCEDURE ... AS $fun$ ... $fun$'; END; $do$; Yours, Laurenz Albe
В списке pgsql-general по дате отправления