Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

libpq normally connects to a unix socket by being given 'localhost' as the hostname or no hostname at all.

IIRC it'll also accept a path -as- a hostname but I'm guessing from your phrasing the field validation won't.



Are you sure about localhost? I'm not familiar with other libpq clients, but psql definitely always resolves localhost to an IP address for me.

You're right about it accepting a path (and defaulting to a compile-time selected UNIX socket path).


> libpq normally connects to a unix socket by being given 'localhost' as the hostname or no hostname at all.

'localhost' for a unix socket doesn't sound right. 'localhost' is a specific network address and has a default configuration in pg_hba.conf (127.0.0.1) for itself. It's different to the 'local' entry in pg_hba.conf that's specifically for unix sockets.

And yeah, the field validation in the IDE required some kind of value in the hostname field, and wouldn't take a path (ie /var/...etc), so no kind of fallback behaviour seemed workable. :(


localhost as unix socket shortcut is actually MySQL behavior: https://dev.mysql.com/doc/c-api/8.4/en/mysql-real-connect.ht...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: