Page 1 of 1

locks detecting

Posted: Tue 25 Jan 2005 18:34
by heme
hi,

how can i detect a lock on a table or
a lock on a row (SELECT .... FOR UPDATE)

is this the right way, if i use the property connectiontimeout,
but i think there is a better way?

thank's

locks detecting

Posted: Wed 26 Jan 2005 16:29
by Yuri
Information about lock tables you can obtain from the table pg_locks.
Here you get a list of locked tables at the moment of execution the query:

Code: Select all

select pg_class.relname from pg_locks inner join pg_class on relation = pg_class.oid
where pg_class.relname  'pg_locks' and pg_class.relname  'pg_class'

hi

Posted: Wed 03 Feb 2010 13:22
by james-locksmith
is there any way to detect keys as well

Posted: Thu 04 Feb 2010 10:54
by StanislavK
Please specify the keys you mean. If, e.g., these are table primary keys, you may get their descriptions using the GetSchema method of the PgSqlConnection object:

Code: Select all

DataTable primaryKeys = pgSqlConnection1.GetSchema(PgSqlMetaDataCollectionNames.PrimaryKeys);