A tale of making company-wide standard psqlrc

At a company we have literally thousands of Pg servers. The layout is also kinda non-obvious. Each database is named the same, but contains different data. And in front of it all, we have pgbouncers.

After some talk, it was suggested that perhaps we could make psql prompt show which database it is connected to. And perhaps some more information, like backend pid. I thought it will be simple…

Continue reading A tale of making company-wide standard psqlrc

Suppressing CONTEXT lines in psql

CONTEXT messages are quite informative, but when you don't need them, they can be real pain in the eyes:

psql:trees.sql:68: NOTICE:  Adding tree structures to table public.testit.
CONTEXT:  SQL function "add_tree_structure" statement 1
psql:trees.sql:68: NOTICE:  Tree table will be public.testit_tree.
CONTEXT:  SQL function "add_tree_structure" statement 1
psql:trees.sql:68: NOTICE:  Primary key in source table is: id
CONTEXT:  SQL function "add_tree_structure" statement 1

I mean – I know the context. I'm writing the sql file right now, how to disable it?

Continue reading Suppressing CONTEXT lines in psql