Disabling NOTICE messages when using ruby-postgres

Does anyone know if there’s a way to disable the NOTICE messages when using
ruby-postgres? Example:

require 'dbi’
db = DBI::connect(‘dbi:pg:setest:localhost’, ‘setest’, ‘setest’)
db.execute(“CREATE TABLE test (id SERIAL PRIMARY KEY)”)

=> NOTICE: CREATE TABLE will create implicit sequence ‘test_id_seq’ for
SERIAL column ‘test.id
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index
’test_pkey’ for table ‘test’

I realize I’m using DBI, but it’s Postgres that is at fault - evidently it
prints out some information straight to stderr.

Thanks,

Nathaniel

<:((><

  require 'dbi'
  db = DBI::connect('dbi:pg:setest:localhost', 'setest', 'setest')

     db.execute("set client_min_messages = warning")

  db.execute("CREATE TABLE test (id SERIAL PRIMARY KEY)")

Guy Decoux

Thanks, Guy!

Nathaniel

<:((><

···

ts [mailto:decoux@moulon.inra.fr] wrote:

require ‘dbi’
db = DBI::connect(‘dbi:pg:setest:localhost’, ‘setest’, ‘setest’)

 db.execute("set client_min_messages = warning")

db.execute(“CREATE TABLE test (id SERIAL PRIMARY KEY)”)