The psql client supports the modification of its prompt. This can be helpful for displaying various pieces of information in an obvious way (what could be more obvious than the prompt?). Prompt information is stored in the PROMPT1, PROMPT2, and PROMPT3 variables within psql . Each of these variables is displayed within the program at different times: PROMPT1 contains the normal (default) prompt information, PROMPT2 contains the prompt information that is displayed on a new line during a statement or query that you have not terminated yet (either because you have not ended it with a semi-colon or the \g command), and PROMPT3 contains the prompt information displayed while entering data during an SQL COPY command. To view how your prompts are currently configured, use the \set command without arguments to view the a list of defined variables. Within this list there should be three prompts, labeled PROMPT[1-3] with single-quotes surrounding the configurable display string. The % are variables; all other characters are printed directly as shown.
Example 4-57. A Default PROMPT1
PROMPT1 = '%/%R%# '
Example 4-58. A Default PROMPT2
Displayed (if a parenthesis has not been closed, thus showing you that it is currently open):
PROMPT2 = '%/%R%# '
Example 4-59. A Default PROMPT3
PROMPT3 = '>> '