Thread: relation column in pg_locks

relation column in pg_locks

From
Frank Kurzawa
Date:
How can I find out what object corresponds to a given OID in the
relation column in the pg_locks table?

Thanks in advance,

Frank


Re: relation column in pg_locks

From
Tom Lane
Date:
Frank Kurzawa <fkurzawa@topazsoftware.com> writes:
> How can I find out what object corresponds to a given OID in the
> relation column in the pg_locks table?

Join to pg_class.oid:

select relname from pg_locks, pg_class where relation = pg_class.oid;

or cast it to regclass:

select relation::regclass from pg_locks;

            regards, tom lane