Skip to content

Commit c32d365

Browse files
authored
Don't put empty string values in connection string when they aren't provided
1 parent 4f4b93f commit c32d365

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/Codd/Types.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,15 @@ libpqConnString ConnectionString {..} =
6464
where
6565
mixedKwvps =
6666
catMaybes
67-
[ Just ("user", quote user),
67+
[ if user == "" then Nothing else Just ("user", quote user),
6868
Just
6969
("host", quote hostname),
70-
Just
71-
("dbname", quote database),
72-
Just ("password", quote password),
70+
if database == ""
71+
then Nothing
72+
else
73+
Just
74+
("dbname", quote database),
75+
if password == "" then Nothing else Just ("password", quote password),
7376
Just ("port", quote (show port)),
7477
options >>= (Just . ("options",)) . quote
7578
]

0 commit comments

Comments
 (0)