Neil Conway wrote:> I've been working on the TODO list item "Add SHOW command to display> locks". The code is basically
finished,but I'd like to make sure the> user interface is okay with everyone before I send it in to -patches> (if
you'reinterested, the patch is attached).>> Rather than adding another SHOW command, I think using a table> function is
abetter idea. That's because the information returned by> the lock listing code will often need to be correlated with
other>information in the system catalogs, or sorted/aggregated in various> ways (e.g. "show me the names of all locked
relations",or "show me> the relation with the most AccessShareLocks'"). Written as a table> function, the lock listing
codeitself can be fairly simple, and the> DBA can write the necessary SQL queries to produce the information he> needs.
Italso makes it easier to parse the lock status information,> if you're writing (for example) a GUI admin tool.
I'm undoubtedly biased ;-), but I like your approach. Applies and works
fine here.
> Also, should locks on special relations (e.g. pg_xactlock) or on> system catalogs be shown?
Maybe the function should take a boolean parameter to indicate whether
or not to show locks on objects in pg_* schema?
Joe