pgocaml icon indicating copy to clipboard operation
pgocaml copied to clipboard

set PGOCaml_config.default_unix_domain_socket_dir during runtime

Open rgrinberg opened this issue 9 years ago • 2 comments

It seems like this variable is being set at build time but that leads to confusing behavior where if you install postgres AFTER installing pgocaml then the value will be wrong.

Can this check be moved to the runtime and wrapped with a lazy block or something to avoid stuff like this?

rgrinberg avatar Nov 03 '15 20:11 rgrinberg

Note that the most reliable solution is to always explicitly provide the unix_domain_socket_dir parameter of the connect function. The default value being set at compile time with some Makefile magic is indeed a bit of a hack: it does not work for all scenarios (like the one you mention), but it's a good-enough-default for most users. The problem with moving it to runtime is that we'll need functions to read the filesystem, which will complicate the whole monadic IO approach.

darioteixeira avatar Nov 04 '15 10:11 darioteixeira

IMO doing this check in a blocking fashion is harmless. But I can do it in my own code just as well. This is quite counter-intuitive behavior though so it should be noted somewhere.

rgrinberg avatar Nov 19 '15 00:11 rgrinberg