views:

78

answers:

3

How do I stop psql (postgres?) from outputting 'useless' notices? e.g.

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

yes psql I know, now be a good tool and stop telling me that you're doing things I want you to do. IMO a program should be silent unless it has an error, or some other reason to output stuff.

+1  A: 

Use --quiet when you start psql.

Ps. A notice is not useless, but that's my point of view :)

Frank Heikens
interesting... that shuts up all the stuff like `CREATE TABLE` but not the `NOTICE's` I'm not sure that I really think all of them are useless... but I do have a bit of a belief (and I think I read it in one of those must read C or Unix books) that programs should be quiet unless they have a problem or you tell them not to be. so --quiet should be the default and there should be a --verbose (perhaps with customizable levels)
xenoterracide
+3  A: 
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".

Milen A. Radev
This can also be changed in postgresql.conf
a_horse_with_no_name
A: 

Probably the most comprehensive explanation is on Peter Eisentrauts blog entry here

Gavin