Monday
Dec072009
Shut up, Postgres!
Monday, December 7, 2009 at 4:35PM
If you've run Rails tests or specs against a PostgreSQL database, you're probably used to seeing an endless stream of messages march down the screen:
NOTICE: CREATE TABLE will create implicit sequence "authorizations_id_seq" for serial column "authorizations.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "authorizations_pkey" for table "authorizations"
NOTICE: CREATE TABLE will create implicit sequence "catalog_organizations_id_seq" for serial column "catalog_organizations.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "catalog_organizations_pkey" for table "catalog_organizations"
NOTICE: CREATE TABLE will create implicit sequence "catalog_products_id_seq" for serial column "catalog_products.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "catalog_products_pkey" for table "catalog_products"
Turns out that you don't have to accept all that chatter. To turn it off, just put this in your .bash_profile or other startup file:
export PGOPTIONS='-c client_min_messages=WARNING'
Voila, all notices will be suppressed and hidden.
in
Miscellany
Miscellany 
Reader Comments (1)
You can also just put "min_messages: warning" under each key in database.yml, which rails does by default when generating a new app with postgres.