Repository navigation
Allow setting connection string to null/empty - #4461
Conversation
|
In that context, out of curiosity, I just thought about what our behavior would be if there is no connection string but all the information needed to connect is set via environment variables. It turns out that (at least from looking at our docs) this is not possible because you have to set at least the host as we don't default to unix domain sockets on Linux and localhost on Windows like libpq does and we don't support the Is there a story behind that? |
|
Good question, and it seems a bit tricky. We could indeed allow connections even with an empty connection string, if all information is provided in environment variables. However, for perf reasons we'd probably want to assume the environment variables don't change during the application lifetime, otherwise we'd have to fetch them on every open (if anything is missing on the connection string, e.g. host, port, dbname...). This is also valid for partial connection strings. For example, I never specify the port, because it defaults to 5432. But I imagine this can be overridden via PGPORT... Can you please open a new issue for that? Since nobody asked for it we can probably leave it in the backlog for now, but good to track it... |
Co-authored-by: Nikita Kazmin <[email protected]>
Fixes #4460