psql advanced settings

The psql client can be personalized. The .psqlrc file is used to store user preferences for later use. There are several aspects of psql personalization, including the following:

  • Look and feel
  • Behavior
  • Shortcuts

You can change the psql prompt to show the connection string information including the server name, database name, username, and port. The psql variables—PROMPT1, PROMPT2, and PROMPT3—can be used to customize user preferences. PROMPT1 and PROMPT2 are issued when you create a new command and a command that expects more input, respectively. The following example shows some of the prompt options; by default, when you connect to the database, only the name of the database is shown.

The set meta-command is used ...

Get Learning PostgreSQL 11 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.