On Thu, Aug 20, 2009 at 06:24:27PM +0200, Thomas Chust wrote:
> * A complete usage example has been added to the documentation.

In the example, the 'name' column in the 'Tags' table should be TEXT,
shouldn't it?

There's a problem in the 'match method with Postgres, in the presence of
link slots.  If I tweak the example a bit to work under postgres, I get
an error at  (pretty-print ((a-post 'in-reply-to*) 'count)) :

  Error: (collect-results) ERROR:  subquery in FROM must have an alias
  HINT:  For example, FROM (SELECT ...) [AS] foo.

I can fix it by hand by patching up the table clauses:

  #;48> (define r (a-post 'in-reply-to*))
  #;49> (r 'table-clauses)
  ((("(SELECT " "in_reply_to" " AS " "id" " FROM " "Posts" " WHERE " "(" "id" " 
= " ?  )" ")") 1) (("Posts")))
  #;50> (r 'set-table-clauses! '((("(SELECT " "in_reply_to" " AS " "id" " FROM 
" "Posts" " WHERE " "(" "id" " = " ? ")" ") AS _foo") 1) (("Posts"))))
  ((("(SELECT " "in_reply_to" " AS " "id" " FROM " "Posts" " WHERE " "(" "id" " 
= " ? ")" ") AS _foo") 1) (("Posts")))
  #;51> (r 'count)
  0

But you need a sequence generator of some sort because otherwise you'll
get several times the same alias in a query.  I don't know how to do
that, off the top of my head.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpeq8tAB6Lgi.pgp
Description: PGP signature

_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to