Sometimes you may encounter situations where your colleague developer has checked out rules but he or she cannot check in / discard them for some reasons. In my case, the developer’s operator ID was corrupted and he could never log in. Or at other times your colleague may leave the project for unexpected reasons and never come back. With any rules being checked out, you can’t lock the ruleset to release it to a production system. In this post, I am sharing how to discard and clean up the checked out rules by other operators.
First, identify a checked out rule. In this example, operator “kensho.tsuchihashi” has checked out an activity rule, “MyActivity”.
However, this is not enough. Garbage still remains in the database, and you are advised to clean them up.
4-1. Actual rule table
Identify the physical table for the rule type. There are many derived rules table and you can check it from “Test connection” button on the class form. For example, Rule-Obj-Activity is mapped to pr4_rule. You should be able to locate a rule whose pyruleset value is + @. In this example, “kensho.tsuchihashi@”.
This is the checked out rule. You can delete it and this is the same effect as discard operation.
delete from rules.pr4_rule
where pyrulename = 'MyActivity' and pyruleset = 'kensho.tsuchihashi@'
4-2. Data-Rule-Summary (pr4_rule_vw table)
When you check out a rule, the state of being checked out is stored in pr4_rule_vw table. This is not cleaned up by “Release lock” operation and should be taken care of manually.
Another Scenario is if the lock release is not available from the action menu and we don’t have database access.
In that case, we can just get a pzInsKey from the query runner, and we can delete the checkout rule from the table. CheckOut rule has different pzInsKey.
For Example, we can use below query in the query runner.
Create Temp Activity and By using the method: Obj-Delete-By-Handle and Then we can delete the checkout rule from the table.
select pzinskey, pyrulename, pyruleset from {CLASS:Rule-Obj-Report-Definition} where pyrulename='pzShowTraceOpenRule'
or
select pzinskey, pyrulename, pyruleset from rules.pr4_rule where pyrulename='pzShowTraceOpenRule'
@KenshoTsuchihashi Thank you so much for posting! for some reason I got below error while executing the delete query:
Error
There was a problem performing a database query: There was a problem getting a list: code: 0 SQLState: 25006 Message: ERROR: cannot execute DELETE in a read-only transaction
DatabaseException caused by prior exception: org.postgresql.util.PSQLException: ERROR: cannot execute DELETE in a read-only transaction
| SQL Code: 0 | SQL State: 25006
@BhumireddyYesss!! you are absolutely correct. I was using query runner and failed to delete. I just used a temp activity and was able to obj-delete-by-handle. problem solved. thank you so much!