valderman / selda

A type-safe, high-level SQL library for Haskell
https://selda.link
MIT License
478 stars 58 forks source link

PGConnectInfo is more restrictive than PG connection string #136

Closed develop7 closed 4 years ago

develop7 commented 4 years ago

According to https://www.postgresql.org/docs/12/libpq-connect.html#id-1.7.3.8.3.6, any part of a connection string is optional, which is not the case for the PGConnectInfo — host, port and dbname here are required. For instance, this renders connecting with simple dbname=somedatabase unfeasible, except maybe setting host and port to " " which seems quite a hack to me.

valderman commented 4 years ago

I agree, that is indeed hacky and shouldn't be needed. The best way to support this is probably to just allow using a plain connection string as an alternative to the current PGConnectInfo, I guess? Coming up with a more structured representation sounds like overengineering to me.