[BUGS] BUG advisory_lock
DECLARE varUnlocked boolean; BEGIN varUnlocked:= pg_try_advisory_lock( 783264760123456 ); -- Try to lock function IF not varUnlocked THEN return NULL; END IF; -- exit if locking is unsucessfull WRONG QUERY HERE WHICH INTERRUPT EXECUTION varUnlocked:= pg_advisory_unlock( 783264760123456 ); -- unlock function END NEXT time when I run this function I always get NULL until server reboot EXPECTED: Pg must unlock if function execution failed
Re: [BUGS] BUG #4116: Cannot create tablespace: could not set permissions on directory
Tom Lane wrote: This code makes the incorrect assumption that the platform will allow the postgres user to set the permissions using chmod. Is this something we should do anything about? IMHO, no. The reason for actually doing the chmod is to verify that we own the directory. If it fails, we don't own the directory in any meaningful sense. I think the complainant's real problem is that he's misconfigured his SELinux permissions. I'm afraid the machine came with SELinux permissions pre-misconfigured for me, and postgres didn't help the situation at all by sending me on a wild goose chase. The correct way to check the permissions are correct is by testing the current permission values against what they should be, and then failing clearly and explicitly with a meaningful error message. Right now the code takes a short cut, which is easy for the coder, but very painful for the long suffering administrator. Regards, Graham -- smime.p7s Description: S/MIME Cryptographic Signature
Re: [BUGS] BUG advisory_lock
<[EMAIL PROTECTED]> writes: > EXPECTED: Pg must unlock if function execution failed This is not a bug; it is the intended and documented behavior of advisory locks. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs
Re: [BUGS] BUG advisory_lock
[EMAIL PROTECTED] wrote: > DECLARE > varUnlocked boolean; > BEGIN > varUnlocked:= pg_try_advisory_lock( 783264760123456 ); -- Try to lock function > IF not varUnlocked THEN return NULL; END IF; -- exit if locking is > unsucessfull > > WRONG QUERY HERE WHICH INTERRUPT EXECUTION > > varUnlocked:= pg_advisory_unlock( 783264760123456 ); -- unlock function > END > > NEXT time when I run this function I always get NULL until server reboot > > EXPECTED: Pg must unlock if function execution failed You can unlock it in an EXCEPTION block to be safe. -- Alvaro Herrerahttp://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs