[postmodern-devel] Dash in Postgresql Column name - "query-dao"

Maciej Pasternacki maciej at pasternacki.net
Wed Dec 3 15:08:26 UTC 2008


On 2008-12-03, at 15:46, Phil wrote:

> query-dao does not seem to like column names with a dash in them like
> column-name and I suspect it would have the same problem with spaces.
>
> I know that the preffered for postgresql would be column_name but I
> though that being able to use the dash would simplify going from db to
> dao object to html and back, well at least for me.
>
> Is column names with dashes just not supported, a bug or on the wish
> list?

Everything is supported with :RAW sql-op:  (select-dao 'foo (:= (:raw  
"\"foo-bar\"") 23)) calls query (SELECT * FROM foo WHERE ("foo-bar" =  
23)) (SELECT-DAO is a shortcut for QUERY-DAO, where you supply only  
the WHERE clause).  There doesn't seem to exist any other way now, but  
it may be possible to add a bit of macro sugar.

Marijn, have you thought of exporting S-SQL::DEF-SQL-OP, so that users  
can create their own "S-SQL macros"?  This may come useful in some  
cases, like above, or to create reusable parametrized query  
fragments.  With complex queries, macros may come in handy.

Regards,
Maciej

-- 
Maciej Pasternacki -><- http://www.pasternacki.net/ -><- http://www.3ofcoins.net/





More information about the postmodern-devel mailing list