[racket] in-query problems

From: George Neuner (gneuner2 at comcast.net)
Date: Thu Dec 11 10:31:00 EST 2014

Hi Ryan,

I re-read your message and did some more experimenting.

On 12/10/2014 2:15 PM, Ryan Culpepper wrote:
> Could you be turning entire rows into records (perhaps to deal with the issue below)?

That seems to be precisely what is happening, although it was forced 
because  in-query  won't accept  return of multiple columns without 
parentheses.  I wasn't aware that the parentheses were being passed 
through to Postgresql.

However, the documentation for in-query says:

    "Executes a SQL query, which must produce rows, and returns a
    sequence. Each step in the sequence produces as many values as the
    rows have columns."

To me that says that  in-query  is supposed to return rows - perhaps as 
(values ...) instead of a vector, but rows nonetheless.  I don't know 
how else to interpret those statements.

 From what you said and what I am seeing, it appears that  in-query 
really is just an iterable form of  query-list - making in-query not as 
useful as it could be.   However, the documentation for query-list  
explicitly says "... must produce rows of exactly one column ...", which 
makes clear the operation.

> One other note: you can also create use cursors through the SQL statements PREPARE, EXECUTE, etc.

Yes.  However, explicit cursor use is not as clean.

> I could add a variant of in-query (maybe ‘in-query-rows’) that for each step produces a vector representing the entire row, rather than one value per field. Would that solve the problem?

That would be wonderful!   I'm still using 6.0.1 if that makes any 
difference, so please issue it as a patch.

> Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141211/e7e6310f/attachment.html>

Posted on the users mailing list.