How to add a banner for EPAS server

Swapnil Suryawanshi
Swapnil Suryawanshi

Sometimes customers request implementing a banner while connecting to the postgresql server, which will help them to identify if that is a production environment, testing environment or Dev environment.

Simply we can set up a banner which at login will display the details about the server which we would like to show.


  • As the enterprisedb or postgres user, create a.psqlrcfile in your home directory that contains something like:
\echo 'Welcome to ENTERPRISEDB!'
  • The above banner will display the message "Welcome to ENTERPRISEDB!". We can modify the message as per our requirements.

Test Case: EPAS 14.5

[enterprisedb@localhost ~]$ vi ~/.psqlrc
[enterprisedb@localhost ~]$
[enterprisedb@localhost ~]$ vi ~/.psqlrc
[enterprisedb@localhost ~]$
-bash-4.2$ psql edb
psql (14.5.0, server 14.5.0)
Type "help" for help.

edb=# \q
-bash-4.2$ cat .psqlrc 
\echo 'Welcome to ENTERPRISEDB!'
-bash-4.2$ pwd
[enterprisedb@localhost ~]$ ls -la .psqlrc
-rw-rw-r--. 1 enterprisedb enterprisedb 36 Jan 18 17:29 .psqlrc
[enterprisedb@localhost ~]$
  • Version-specific psqlrc files can be created if there are multiple PostgreSQL installations. Just add the version number to the end.
For Example:

touch ~/.psqlrc-14.5

Was this article helpful?

0 out of 0 found this helpful