[BUG] setting search_path causes error
- Dominant language
- C
- Stars
- 3.9k
- Forks
- 260
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 1
Description
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?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supplied SQL reproducer on PostgreSQL 14 using pg_cron background worker mode, paying particular attention to the search_path command, procedure call, and COMMIT. Determine whether the reported invalid transaction termination is expected or a pg_cron bug; done means the behavior is fixed or clearly documented and the reproducer no longer fails unexpectedly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100