[postmodern-devel] Incorrect :cast compilation

Marijn Haverbeke marijnh at gmail.com
Tue Oct 28 07:55:39 UTC 2008


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




More information about the postmodern-devel mailing list