Ah, in that case it’s LibPQ that’s failing to do the conversion. Note that the SQLStrings readme says that it:
allows the Julia types of interpolated parameters to be preserved and passed to the database driver library which can then marshal them correctly into types it understands.
i.e. it intentionally preserves the Julia types as they are, so that the DB driver can convert it as appropriate to the backend DB. But in this case, LibPQ apparently doesn’t do any Julia-to-PostgreSQL conversions:
Currently all types are printed to strings and given to LibPQ as such, with no special treatment. Expect this to change in a future release. For now, you can convert the data to strings yourself before passing to
execute.
So you do have to replace nothings with NULLs yourself. You can do that for individual parameters as you’ve done, or you can change the second line in runquery to
LibPQ.execute(conn, query, replace(args, nothing => "NULL"))