Parsing Postgres array

Trying to parse a Postgres array coming back like this: {ditchrider,ditchrider,ditchrider}. This is my query:
db
.select({
userRole: user.role,
soureRole: sql`ARRAY_AGG(${sourceRole.sourceRole})`.as('sourceRole'),
})
.from(user)
.innerJoin(sourceRole, eq(user.id, sourceRole.userId))
.groupBy(user.id)
.where(eq(user.id, input.userId));
db
.select({
userRole: user.role,
soureRole: sql`ARRAY_AGG(${sourceRole.sourceRole})`.as('sourceRole'),
})
.from(user)
.innerJoin(sourceRole, eq(user.id, sourceRole.userId))
.groupBy(user.id)
.where(eq(user.id, input.userId));
.mapWith doesn't work.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server