Is this concat + string_agg with groupBy correct in Drizzle?
Hi everyone,
I’m working with Drizzle ORM (PostgreSQL) and trying to generate a
name
field that combines the product name with all of its attribute values, like:
"T-Shirt, Red, Large"
.
Here’s the code I’m using:
I have two main questions:
- Is this usage of sql<string>concat(..., string_agg(...))
valid and safe in Drizzle?
- Is the .groupBy(productVariantTable.id)
correct in this context? Do I need to group by more columns (like productTable.id
) to avoid SQL errors?0 Replies