PostgreSQL dblink password encrypted or not? I have two PostgreSQL servers:

server 1: 192.168.0.1
server 2: 192.168.0.2

I want to connect to the database on server 2 from server 1. I do it like this:

SELECT dblink_connect('hostaddr=192.168.0.2 port=5432 dbname=mydb user=postgres password=mypasswd');


My question is that when I do such connect my password is send as plaintext or its somehow encrypted during the transmission to the server 2?

I use PostgreSQL 9.3 on Linuxx Mint 16 (server 1) and Xubuntu 13.10 (server 2).
Basically, dblink uses a libpq-style connection info string.
Add sslmode=require to your connection string or a more restrictive setting to disallow unencrypted transfers. More details in the manual here.

I would also advice not to have the password in your SQL statement at all. SQL statements may get logged. Or backups are stored in an insecure location ...
I use the password file .pgpass for dblink connections.