sqlx
sqlx copied to clipboard
Fix postgresql hostaddr semantics
- Before hostaddr was used to just be an alternative way to set
host. But this is not how libpq actually behaves or intents hostaddr to be used. - Instead
hostaddris meant to contain a numeric IP address to connect to, bypassing DNS lookups. This can be useful if the DNS lookups are slow, or if the DNS lookup has to be bypassed as the port is proxied to localhost for ifrastructure reasons. The TLS verification is still always done against thehostparameter. Basically it allows to doverify-fullon proxied ports.
Libpq docs:
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS
Does your PR solve an issue?
Yes but issue was not reported yet, the original implementation of hostaddr parameters only misleading/bad semantics.
Is this a breaking change?
Can be argued both ways. Its definitively a bugfix, but could be that the bug is loadbearing. I'm fine either way, going to use a fork till release.