Postgres still connecting via SSL - despite invalid certificates
The documentation says:


  By default, PostgreSQL will not perform any verification of the server certificate.  


In other words, SSL is used for encryption.


  […]
  To allow the client to verify the identity of the server, place a root certificate on the client and a leaf certificate signed by the root certificate on the server.
  […]
  Once a chain of trust has been established, there are two ways for the client to validate the leaf certificate sent by the server. If the parameter sslmode is set to verify-ca, libpq will verify that the server is trustworthy by checking the certificate chain up to the root certificate stored on the client. If sslmode is set to verify-full, libpq will also verify that the server host name matches the name stored in the server certificate.