Marijn,

That worked. Your documents are so good and "any" does not appear as a sql-op in the documents, so I did not think to look for an additional any* op in the code.

If I can find the time, I think I will compile a giant list of usage examples and put it up somewhere. That will force me to actually understand instead of just use postmodern.

Many thanks.

Sabra


On Mon, Jan 17, 2011 at 3:14 AM, Marijn Haverbeke <marijnh@gmail.com> wrote:
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

_______________________________________________
postmodern-devel mailing list
postmodern-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel