Your wish was granted
https://www.postgresql.org/docs/current/explicit-locking.htm...
https://www.postgresql.org/docs/current/explicit-locking.htm...
The solution to both cases is to define them as either static constants or use an Enum. Then you would not care if the end result is a string or a number.
At my work place we simply have a static class with lock names that we use.
I assume that if you do it this way, then you see a string key in logs, views of current/locked queries, etc. Which should immensely help when debugging any kind of problems.