[postmodern-devel] Anyone tried to use the new recursive with in Postgresql 8.4 with S-SQL?

Sabra Crolleton sabra.crolleton at gmail.com
Thu Oct 1 04:21:52 UTC 2009


I can't seem to get the syntax right using s-sql. I can write a straight sql
statement, but it looks ugly in the middle of a lisp program.

Sample sql statement from the postgresql docs is:

WITH RECURSIVE search_graph(id, link, data, depth, path, cycle) AS (
        SELECT g.id, g.link, g.data, 1,
          ARRAY[g.id],
          false
        FROM graph g
      UNION ALL
        SELECT g.id, g.link, g.data, sg.depth + 1,
          path || g.id,
          g.id = ANY(path)
        FROM graph g, search_graph sg
        WHERE g.id = sg.link AND NOT cycle
)
SELECT * FROM search_graph;

http://www.postgresql.org/docs/8.4/static/queries-with.html

Sabra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20090930/587a0d74/attachment.html>


More information about the postmodern-devel mailing list