disable NOTICES in psql output

xenoterracide picture xenoterracide · Aug 20, 2010 · Viewed 37.8k times · Source

How do I stop psql (PostgreSQL client) from outputting notices? e.g.

psql:schema/auth.sql:20: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "users_pkey" for table "users"

In my opinion a program should be silent unless it has an error, or some other reason to output stuff.

Answer

Milen A. Radev picture Milen A. Radev · Aug 20, 2010
SET client_min_messages TO WARNING;

That could be set only for the session or made persistent with ALTER ROLE or ALTER DATABASE.

Or you could put that in your ".psqlrc".