From 988559747363ef00958fcf782317e76c40ffa2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Beaupr=C3=A9?= Date: Sat, 30 Jul 2022 16:15:47 +0200 Subject: [PATCH] Fix: User may sometimes pass in non-strings, such as integers (#55) --- lib/with_advisory_lock/postgresql.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/with_advisory_lock/postgresql.rb b/lib/with_advisory_lock/postgresql.rb index 3a90c5f..af203b1 100644 --- a/lib/with_advisory_lock/postgresql.rb +++ b/lib/with_advisory_lock/postgresql.rb @@ -21,7 +21,7 @@ def release_lock end def execute_successful?(pg_function) - comment = lock_name.gsub(/(\/\*)|(\*\/)/, '--') + comment = lock_name.to_s.gsub(/(\/\*)|(\*\/)/, '--') sql = "SELECT #{pg_function}(#{lock_keys.join(',')}) AS #{unique_column_name} /* #{comment} */" result = connection.select_value(sql) # MRI returns 't', jruby returns true. YAY!