Use `getTableColumns` with `groupBy`

I am doing a nested query and postgres is requiring that every column I select be in the group by, can I use the method getTableColumns in the groupBy, I've tried just calling the method and destructing. No luck, the error reads "must have a Symbol.iterator method that returns an iterator"
2 Replies
Angelelz
Angelelz11mo ago
Yes, it's expecting an array. This is a workaround:
.groupBy(Object.values(getTableColumns(yourTable)))
.groupBy(Object.values(getTableColumns(yourTable)))
bambam22
bambam22OP11mo ago
Oh thanks!
Want results from more Discord servers?
Add your server