[Haskell-cafe] Property checks and PostgreSQL?

Anthony Clayden anthony_clayden at clear.net.nz
Mon Mar 15 01:00:05 UTC 2021

>  PostgreSQL data base, Haskell back end, PureScript front end. And there
is a fault somewhere in this stack: sometimes some items present in the data
base do not make it to the front end. A small fortune in programmer hours
has been spent ...

Speaking purely from a SQL-and-stuff point of view, "programmer hours
spent" sounds to me like a problem with nulls.

Are any of your columns nullable? Are you sure they should be nullable? In
particular are any of the columns in the keys nullable? Or any of the
columns on which you're joining tables? (Perhaps a proper value in one
table, but a null in the table it's supposed to equal?)

How are you mapping between Haskell field values to/from nullable columns
in the SQL? Is that mapping fool-proof? Is it consistent across different
tables using what should be the same value?

And in general: SQL nulls are an abomination; don't do that; do normalise
your database schema to avoid nulls.

AntC (35 years an SQL programmer, never trusted it)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210315/2ba9a1b6/attachment.html>

More information about the Haskell-Cafe mailing list