A Fresh Cup is Mike Gunderloy's software development weblog, covering Ruby on Rails and whatever else I find interesting in the universe of software. I'm a full-time Rails developer and contributor, available for long- or short-term consulting, with solid experience in working as part of a distributed team. If you'd like to hire me, drop me a line. I'm also the author of Rails Rescue Handbook and Rails Freelancing Handbook.

Navigation
« Double Shot #600 | Main | Double Shot #599 »
Monday
Dec072009

Shut up, Postgres!

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.

References (1)

References allow you to track sources for this article, as well as articles that were written in response to this article.

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.

December 7, 2009 | Unregistered CommenterChad Humphries

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>