diff --git a/lib/pg.rb b/lib/pg.rb index a8884b740..159ff20b6 100644 --- a/lib/pg.rb +++ b/lib/pg.rb @@ -115,4 +115,15 @@ module TextEncoder require 'pg/tuple' autoload :VERSION, 'pg/version' + + # Avoid "uninitialized constant Truffle::WarningOperations" on Truffleruby up to 22.3.1 + if RUBY_ENGINE=="truffleruby" && !defined?(Truffle::WarningOperations) + module TruffleFixWarn + def warn(str, category=nil) + super(str) + end + end + Warning.extend(TruffleFixWarn) + end + end # module PG