[racket] Ryanc db.plt, Postgres and bytea []

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Fri Oct 28 14:18:25 EDT 2011

On 10/28/2011 06:21 AM, Curtis Dutton wrote:
> I've been using db.plt package and it has been working well for me.
> Thanks to Ryan for making it.

You're welcome!

BTW, the db package will be included in the next release as a standard 
Racket library.

> I would like to store and retrieve some binary data in my postgres
> databases. Unfortunatly db.plt says it doesn't support bytea types yet.
> How likely or doable would it be to get support for byta[] in the db.plt
> library. I'm willing to add or help out in any way to get this
> working... Even some pointers on where to start or what the solution
> should look like would be greatly appreciated.

The type "bytea" should work fine. If it doesn't work for you, could you 
send me a short program that illustrates the problem?

Here's a query that returns bytea:

 > (query-value c "select cast('abc' as bytea)")

What doesn't work is PostgreSQL's general array types, like "int[]" or 
"bytea[]". Is that what you have? If so, I can look into adding support 
this weekend. If you want to look around yourself, the relevant code 
(reading and writing) is in db/private/postgresql/dbsystem.rkt, but 
you'll also need information from the postgresql source for the array 
binary format and the pg_type system table for the array type OIDs.


Posted on the users mailing list.