nikita-volkov / hasql-th

Template Haskell utilities for Hasql
http://hackage.haskell.org/package/hasql-th
MIT License
114 stars 8 forks source link

SQL-friendly `NULLABLE` indicator #30

Open sir4ur0n opened 1 year ago

sir4ur0n commented 1 year ago

Currently the way to specify that a field is nullable is to suffix the type hint with ?, e.g. SELECT x :: text?. Unfortunately because this is invalid SQL syntax, it makes it harder to copy/paste SQL queries between an SQL editor/PSQL and Haskell.

Have you already considered an SQL-friendly syntax? E.g. using a comment?

SELECT x :: text /*null*/
nikita-volkov commented 1 year ago

I have not and this does sound like a great idea! However this will possibly require some work on the parser, because it likely doesn't support comments for now. I don't have the time for that, so I'm leaving this one open for PRs.