Delete limit and offset?

I get Property 'limit' does not exist on type 'Omit<PgDelete<PgTableWithColumns> const results = await db .delete(scheduledCalls) .where(eq(scheduledCalls.queueName, queueName)) .limit(limit) .offset(offset)
9 Replies
Waldo
Waldo16mo ago
I'm having this same issue! Thanks
Unknown User
Unknown User5mo ago
Message Not Public
Sign In & Join Server To View
json
json4mo ago
+1 on this
DoggeSlapper
DoggeSlapper4mo ago
Use sub query
Mario564
Mario5644mo ago
We're working on implementing limit and order by to mutation queries in MySQL in SQLite, however, PG doesn't have such a feature in its engine. You can write a raw query that adds limit to delete in PG but you'll get a runtime error in that case
DoggeSlapper
DoggeSlapper4mo ago
ye that's usually handled with a subquery if u need too
Mario564
Mario5644mo ago
Because of that, PG recommends what Dogge said
DoggeSlapper
DoggeSlapper4mo ago
delete were id in (whatever query u want) @Mario564 he was looking for offset too, so wont be possible either on mysql/maridb as just can use LIMIT
Mario564
Mario5644mo ago
Yeah, offset isn't available in any engine for mutation queries
Want results from more Discord servers?
Add your server