Hello there,
I am trying to insert an array of composite type, I have looked at the doc
for pg_array and pg_row (and also pg_array_ops and pg_row_ops) and I am
uncertain about the process to do it.
I have a clients tables with a addresses column which is an array of a
composite type address (itself containing an array).
First, I load pg_array and pg_row module, define the composite type:
DB.extension(:pg_array, :pg_row)
DB.register_row_type(:address)
clients = DB[:clients]
Then, setup my object to insert:
address1 = {
line1: "34 rue de Paris",
line2: null,
zip: "75001",
coordinates: [48.8567, 2.3508]
}
client = {
name = "Joe",
addresses = ? # would be [address1] in a normal ruby object
}
I have tried these solutions:
addresses = Sequel.pg_array(address1, :address)
and
addresses = Sequel.pg_array(DB.row_type(:address, address1))
and
addresses = Sequel.pg_array(DB.row_type(:address, address1), :address)
But they all result in a malformed queries.
Any pointer would be highly appreciated.
Thanks!
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.