Fix report request crash when using dup. attr idents
When request to /report endpoint with multiple attributes using the same ident was used, request crashed with an error that Scan expects N+M destinations but got N. This was due to the way scan destination slice was constructed, using column ident as unique key. Only problem for aggregations. Example: /report?metrics=SUM(Amount)+AS+sum_amount,SUM(Amount)+AS+sum_amount Error: sql: expected 4 destination arguments in Scan, not 3" This is now done only for attributs with store type SimpleJsonDocColumn. Ref: #465
This commit is contained in:
parent
97fd780edf
commit
88bafc2f15
@ -54,12 +54,12 @@ func NewTableCodec(m *dal.Model, d Dialect) *GenericTableCodec {
|
||||
attr = m.Attributes[a]
|
||||
colIdent = attr.StoreIdent()
|
||||
|
||||
if done[colIdent] {
|
||||
continue
|
||||
}
|
||||
|
||||
switch attr.Store.(type) {
|
||||
case *dal.CodecRecordValueSetJSON:
|
||||
if done[colIdent] {
|
||||
continue
|
||||
}
|
||||
|
||||
// when dealing with encoded types there is probably
|
||||
// a different column that can handle the encoded payload
|
||||
cols = append(cols, &SimpleJsonDocColumn{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user