Olly Legg home

Suppressing PostgreSQL NOTICEs

21 Feb 2012

For some of our projects at work recently we've switched to using PostgreSQL. Annoyingly it outputs quite a lot of logging by default when creating tables — which clutters up test runs with a lot of unimportant logging.

NOTICE:  CREATE TABLE will create implicit sequence "accounts_id_seq" for serial column "accounts.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "accounts_pkey" for table "accounts"
NOTICE:  CREATE TABLE will create implicit sequence "users_id_seq" for serial column "users.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"

The easiest way to globally suppress this output is to change the client_min_messages setting in postgresql.conf to warning. The config file now reads like this:

client_min_messages = warning

If you installed PostgreSQL using Homebrew the config file can be found at /usr/local/var/postgres/postgresql.conf. After updating the config file, run the following to restart the server.

launchctl unload -w ~/Library/LaunchAgents/org.postgresql.postgres.plist
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist