Skip to content

Commit

Permalink
Merge pull request #13 from nettrash/postgresql-code-block-escape
Browse files Browse the repository at this point in the history
Added $pg_dbms_job$ as a block for job execution.
  • Loading branch information
darold authored Nov 8, 2023
2 parents 7e1729d + bc342a7 commit 4d6884c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/pg_dbms_job
Original file line number Diff line number Diff line change
Expand Up @@ -946,15 +946,15 @@ sub subprocess_asynchronous_jobs
my $sqlstate = '';
my $t0 = time;

my $codetoexec = qq{DO \$\$
my $codetoexec = qq{DO \$pg_dbms_job\$
DECLARE
job bigint := $jobid;
next_date timestamp with time zone := current_timestamp;
broken boolean := false;
BEGIN
$ASYNC_JOBS{ $jobid }{ 'what' }
END;
\$\$;
\$pg_dbms_job\$;
};
dprint('DEBUG', "executing code of job id $jobid: $ASYNC_JOBS{ $jobid }{ 'what' }");
if (not $ldbh->do($codetoexec))
Expand Down Expand Up @@ -1092,15 +1092,15 @@ sub subprocess_scheduled_jobs
my $status = '';
my $sqlstate = '';

my $codetoexec = qq{DO \$\$
my $codetoexec = qq{DO \$pg_dbms_job\$
DECLARE
job bigint := $jobid;
next_date timestamp with time zone := current_timestamp;
broken boolean := false;
BEGIN
$SCHEDULED_JOBS{ $jobid }{ 'what' }
END;
\$\$;
\$pg_dbms_job\$;
};
dprint('DEBUG', "executing code of job id $jobid: $SCHEDULED_JOBS{ $jobid }{ 'what' }");

Expand Down

0 comments on commit 4d6884c

Please sign in to comment.