tests for procedures(not function) having transaction block in it(like commit)

27 views
Skip to first unread message

mgs

unread,
Jul 23, 2024, 1:33:24 AM7/23/24
to pgTAP Users
is there a way to write tests for procedure having commit block in it using pgtap I am using scripting style to write tests without actually modifying procedure itself.

CREATE OR REPLACE PROCEDURE foo.do_something(IN i_value INT)
AS
$$
BEGIN
     # some delete statement 
      commit;
END; $$
LANGUAGE plpgsql;

David E. Wheeler

unread,
Jul 23, 2024, 10:29:01 AM7/23/24
to mgs, pgTAP Users
I don’t think you can in a single test; pgTAP was written long before this feature existed, and generally assumes all tests run in a single transaction. Perhaps you could write other procedures that do the testing and control the transactions?

I’m guessing here, as I’ve not messed with procedures yet myself.

Best,

David

Reply all
Reply to author
Forward
0 new messages