Hi.
I've upgraded from postmodern-0.24 to 1.13 recently and noticed that :cast is incorectly escaped in sql expressions.
(sql-compile '(:cast (:as value :BIGINT)))
produces
"cast"(value AS bigint)
which results in postgres error.
Removing "cast" from s-sql::*postgres-reserved-words* seems to fix the things.
Hello Yuri,
(sql-compile '(:cast (:as value :BIGINT)))
Aha -- I hadn't used CAST before, the fact that :as works here is kind of incidental. CAST does exactly the same as the '::' operator, though -- see the :type operator in S-SQL. Just removing 'cast' from the list of reserved words is not a good idea, since then you can't have rows named 'cast' in your tables anymore. I could add an operator like this...
(def-sql-op :cast (value type) `("CAST(" ,@(sql-expand value) " AS " ,(to-type-name type) ")"))
... but maybe it makes more sense not to support both syntaxes and just use :type instead?
Cheers, Marijn
postmodern-devel@common-lisp.net