Add banner motd to postgres database I would like to present a banner motd (message of the day) to users that connect to a Postgresql database. Similar to cisco router and switch cli where you use:

banner motd "Seien Sie bitte vorsichtig....."


And then upon logging into the switch/router you see that message.

I'd like to see something similar when connecting to a database.

example:

$ psql postgres
psql (12.0)
Type "help" for help.
Seien Sie bitte vorsichtig.....

postgres=#
You cannot force that on the server side, because the server cannot control what a client displays.

But yan can do it on the client side: create a .psqlrc file in your home directory that contains something like:

\echo Seien Sie bitte vorsichtig.....


But I assume, given the text of the warning, that you want this bannet only for certain sensitive databases.

For that, you could have  banner table in every database, and the statement in .psqlrc would be like:

\set QUIET on
\pset format unaligned
SELECT * FROM banner;
\pset format aligned
\set QUIET off