Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executing multiple statements in one job but logging only first statement's output #349

Open
bsislow opened this issue Aug 20, 2024 · 0 comments

Comments

@bsislow
Copy link

bsislow commented Aug 20, 2024

why do multiple statements in one job only log the first statement's output in cron.job_run_details in return_message?

example:

postgres=> create table a (b timestamp with time zone);
CREATE TABLE

postgres=> SELECT cron.schedule('* * * * *', $$select count(*) from a;insert into a select now();insert into a select now();$$);
 schedule
----------
       24
(1 row)

postgres=> select * from a;
               b
-------------------------------
 2024-08-20 14:10:00.068271+00
 2024-08-20 14:10:00.068271+00
(2 rows)

select * from cron.job_run_details order by end_time desc limit 1;
 jobid | runid | job_pid |  database   |  username   |                                     command                                     |  status   | return_message |          start_time
       |           end_time
-------+-------+---------+-------------+-------------+---------------------------------------------------------------------------------+-----------+----------------+------------------------
-------+-------------------------------
    25 |   664 |   11186 | postgres    | postgres    | select count(*) from a; insert into a select now(); insert into a select now(); | succeeded | INSERT 0 1     | 2024-08-20 14:10:00.010
36+00  | 2024-08-20 14:10:00.084913+00

we only see INSERT 0 1 here. this is restrictive when we're running a job that executes DELETEs that have child dependencies - in order, for example.

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant