Subquery in insertInto fails with "TypeError: Converting circular structure to JSON"
Opened this issue · 0 comments
phiresky commented
const id = 123;
await db.single(
sql
.insertInto(a)
.value({
id,
foo: sql
.from(bar)
.where({ id })
.select(bar.x)
.asExpression()
})
);
creates a query like
INSERT INTO roulette.games(id, foo) VALUES ($1, $2)
Trying to pass the inner query directly to pg
.