On Postgres with_advisory_lock converts non-numeric lock names to integers by converting the lock name to a string and then computing the hash of the string. Unfortunately Ruby MRI 1.9 uses a session local random seed in the String hash method so hash codes will be different in different MRI instances. See this Stackoverflow question for more details. It looks like using Zlib.crc32 instead should do the trick.