sql.scm was intended for sqlite, so you need to use some workarounds sometimes.
When you need to reference a fieldname with a space in it, try:
(SELECT ALL (|"field one"| field2) FROM table)
by using the pipe, you can force many things. For example, Postgresql allows
SELECT DISTINCT ON (groupname) field1, groupname, field3 FROM table1
you can do this in sql.scm with:
(SELECT DISTINCT (|ON (groupname) field1| groupname field3) FROM table1)