Postgresql – There is an equivalent of login.sql on PostgresSQL

oraclepostgresqlpsqlsqlplus

When you log on Oracle database with SQLplus, it looks for a login.sql file in the current directory. If the file exists, it's executed.

It's usefull to set preferences…

There is an equivalent when I log to a PostgreSQL database with psql ?

Best Answer

Yes, there is. It's stored in ~/.psqlrc

More details in the manual: http://www.postgresql.org/docs/current/static/app-psql.html#AEN85369