-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PostgreSQL 16 Administration Cookbook
By :

When you’re connecting to multiple systems, it can be useful to configure your psql
prompt so that it tells you what you are connected to.
To do this, we will edit the psql
profile file so that we can execute commands when we first start psql
. In the profile file, we will set values for two special variables, called PROMPT1
and PROMPT2
, that control the command-line prompt.
Identify and edit the ~/.psqlrc
file that will be executed when you start psql
.
My psql
prompt looks like this:
Figure 7.1: A customized psql prompt
As you can see, it has a banner that highlights my employer’s company name, an idea I read from Simon Riggs in a previous edition of this book, which he set for when we do demos. You can skip that part, or you can create some word art, being careful with backslashes since they are escape characters:
\echo '________ _____ _______...
Change the font size
Change margin width
Change background colour