Cannot insert multiple rows
cespare opened this issue · 2 comments
cespare commented
When I try to insert multiple rows at once, I get a RethinkDB error.
This is fine:
if err := r.Table("counters").Insert(rows[0]).Run(session).One(response); err != nil {
this doesn't work:
if err := r.Table("counters").Insert(rows[0], rows[1]).Run(session).One(response); err != nil {
// -> rethinkdb: Server could not make sense of our query: Expected 2 argument(s) but found 3.
and this is right out:
if err := r.Table("counters").Insert(rows...).Run(session).One(response); err != nil {
// -> rethinkdb: Server could not make sense of our query: Expected 2 argument(s) but found 745.
Let me know if you can repro this easily at your end; otherwise I can make a more detailed repro case.
cespare commented
BTW, is there a convenient way to see the compiled query? I didn't notice one, but I only skimmed the docs and searched for 'protobuf' and similar terms.
cespare commented
OK, I have the answers to both questions:
- I just use
.Insert(rows)
; apparently that works with a single row or an array of rows. Should this function not be variadic? r.SetDebug(true)