dbTalk Databases Forums  

Lock Table

comp.databases.postgresql comp.databases.postgresql


Discuss Lock Table in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Enzo Campanella
 
Posts: n/a

Default Lock Table - 09-16-2009 , 08:29 AM






Hello.

Let me know if you can know if a table is locked by a lock
Type:
Begin Work
Lock Table MySchema.MyTable IN ACCESS EXCLUSIVE MODE
.....
Unlock Table or Commit

For example:
select * from islock(TableName)
Thanks
Enzo

Original Message:

Ciao.

Vorrei sapere se è possibile sapere se una tabella è bloccata da un Lock
del tipo:
Begin Work
Lock table MySchema.MyTable IN ACCESS EXCLUSIVE MODE
.....
Unlock Table o Commit

per esempio:
select * from islock(tablename)

Grazie
Enzo

Reply With Quote
  #2  
Old   
Enzo Campanella
 
Posts: n/a

Default Re: Lock Table - 09-16-2009 , 09:13 AM






Thanks to all.
I found the solution:

SELECT pg_class.relname, pg_database.datname, transactionid, pid, mode,
granted
FROM pg_locks, pg_class, pg_database
WHERE pg_locks.relation = pg_class.oid
AND pg_locks.database = pg_database.oid and relname='MyTable'

Enzo.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.