Fork me on GitHub
#honeysql
<
2023-02-25
>
p-himik22:02:01

Lots of https://www.postgresql.org/docs/current/functions-string.html#FUNCTIONS-STRING-SQL need to have things like a FROM b in their arguments, e.g. substring(scope FROM 5 FOR 7). Do I understand it correctly that a proper way to do it is to register a custom function?

seancorfield18:02:50

Yes, register-fn! will let you add special syntax. This sounds worth being added to core -- can you create an issue with a link to the relevant PG docs and I'll take a look?

seancorfield05:03:25

For anyone interested in trying out the potential solution to this, develop has been updated with :*foo style keywords in function arguments being treated as a interspersed SQL keywords -- see these tests for examples: https://github.com/seancorfield/honeysql/blob/develop/test/honey/sql_test.cljc#L1112-L1132 -- the syntax is still open to debate but the machinery seems reasonable.

seancorfield05:03:25

For anyone interested in trying out the potential solution to this, develop has been updated with :*foo style keywords in function arguments being treated as a interspersed SQL keywords -- see these tests for examples: https://github.com/seancorfield/honeysql/blob/develop/test/honey/sql_test.cljc#L1112-L1132 -- the syntax is still open to debate but the machinery seems reasonable.