Shriram Sunder
08/16/2022, 8:55 PMpanic: table name already provided: invalid message
This is the code that does the insertion... am I doing anything wrong? It works exactly as expected when I used the exact same code for another table to insert all the tickers info.
sender, _ := QDBConnectILP(ctx)
defer sender.Close()
// For each of these results, push!
for _, agg := range aggBar.Results {
err := sender.Table("aggs").
Symbol("ticker", aggBar.Ticker).
StringColumn("timespan", timespan).
Int64Column("multiplier", int64(multiplier)).
Float64Column("timestamp", agg.T).
Float64Column("open", agg.O).
Float64Column("high", agg.H).
Float64Column("low", agg.L).
Float64Column("close", agg.C).
Float64Column("volume", agg.V).
Float64Column("vw", agg.Vw).
Float64Column("n", float64(agg.N)).
At(ctx, time.Now().UnixNano())
CheckErr(err)
}
// Make sure that the messages are sent over the network.
err = sender.Flush(ctx)
CheckErr(err)
Bolek Ziobrowski
08/17/2022, 7:14 AMfunc TestErrorOnMultipleTableCalls(t *testing.T) {
ctx := context.Background()
srv, err := newTestServer(readAndDiscard)
assert.NoError(t, err)
defer srv.close()
sender, err := qdb.NewLineSender(ctx, qdb.WithAddress(srv.addr))
assert.NoError(t, err)
defer sender.Close()
err = sender.Table(testTable).Table(testTable).AtNow(ctx)
assert.ErrorContains(t, err, "table name already provided")
assert.Empty(t, sender.Messages())
}
Andrey Pechkurov
08/17/2022, 8:32 AMShriram Sunder
08/19/2022, 2:36 AMdefer sender.Close()
at the beginning.
I don't really see how I can minimally reproduce this error on GH, this requires connecting to an existing QuestDB instance.Andrey Pechkurov
08/19/2022, 5:29 AMwhen I explicitly closed the sender instead of defer sender.Close() at the beginningThat's weird.
defer sender.Close()
acts as if you had sender.Close()
at all return points of your functionShriram Sunder
09/04/2022, 7:58 PMdefer sender.close()
works, I'm just describing a behaviour that I encountered. I admit it's weird, but ... that's what worked.
I'm developing on a Windows system, if that makes any difference.Andrey Pechkurov
09/05/2022, 6:13 AM