[postmodern-devel] Syntax help requested

Marijn Haverbeke marijnh at gmail.com
Mon Jan 17 11:14:33 UTC 2011


Hi Sabra,

user> (s-sql:sql (:select 'pg_attribute.attname (:format-type
'pg_attribute.atttypid 'pg_attribute.atttypmod)
                           :from 'pg_index 'pg_class 'pg_attribute
                           :where (:and (:= 'pg_class.oid (:type '$1 regclass))
                                        (:= 'indrelid 'pg_class.oid)
                                        (:= 'pg_attribute.attrelid
'pg_class.oid)
                                        (:= 'pg_attribute.attnum
(:any* 'pg_index.indkey)))))

This gives me a query similar to what you want. Note the clunky :any*
-- this is because Postgres has both a function-call-style any and an
infix any, and S-SQL's syntax doesn't allow them to be distinguished.

Best,
Marijn




More information about the postmodern-devel mailing list