[postmodern-devel] darcs patch: add support for the currval() and lastval() functions

Marijn Haverbeke marijnh at gmail.com
Sun Aug 30 18:03:34 UTC 2009


>    * (s-sql:sql-compile '(:select (:currval players_id_seq)))
>    "(SELECT currval(players_id_seq))"

>    * (s-sql:sql-compile '(:select (:currval players_id_seq)))
>    "(SELECT currval(E'players_id_seq'))"

> It seems that the default function expansion doesn't escape object names.

The Postgresql currval/nextval functions take strings. Passing a
symbol, in S-SQL means passing an identifier. If you are generating
s-sql expressions, have a symbol where you need a string, you can just
call to-sql-name on it. Doing it that way should also make calling
setval easier.

Best,
Marijn




More information about the postmodern-devel mailing list