[racket] How to insert array into Postgresql using DB module

From: J G Cho (gcho at fundingmatters.com)
Date: Thu Jan 3 17:08:27 EST 2013

Postgresql allows

INSERT INTO sal_emp
    VALUES ('Bill',
    '{10000, 10000, 10000, 10000}',
    '{{"meeting", "lunch"}, {"training", "presentation"}}');

I have inherited this table that is not quite normalized and has
columns that are expecting arrays.

Can I do something like following?

(query conn
         "INSERT INTO sal_emp VALUES ($1, $2. $3)"
        "Bill"
        (list 10000 10000 10000 10000)
        (list (list "meeting" "lunch") (list "training" "presentation")))

Or do I have to convert the list into a string agreeable by SQL?

Thanks in advance.

jGc

Posted on the users mailing list.