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

[BUG] setting search_path causes error #333

Open
cwang9208 opened this issue Jun 11, 2024 · 1 comment
Open

[BUG] setting search_path causes error #333

cwang9208 opened this issue Jun 11, 2024 · 1 comment

Comments

@cwang9208
Copy link

Hi,

We're using the latest pg_cron with the background worker mode in PostgreSQL-14. But the following simple code snippet would fail:


create table employees(emp_id int, increase_amount int, id int, salary int);

CREATE OR REPLACE PROCEDURE update_salary(employ_id INT, inc_amount INT)
LANGUAGE plpgsql
AS $$
BEGIN
   UPDATE employees
   SET salary = salary + inc_amount
   WHERE id = employ_id;
   
   COMMIT;
END;
$$;


-- Call a stored procedure every 5 seconds
SELECT cron.schedule('dummy', '5 seconds', 'set search_path to public; CALL update_salaryy(1, 500);');

The error message is ERROR: invalid transaction termination.

Can anyone help look into this problem?

@japinli
Copy link
Contributor

japinli commented Jun 17, 2024

it seems there is a typo. s/update_salaryy/update_salary/g.

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

2 participants