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
Waldo14mo ago
I'm having this same issue! Thanks
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
json
json3mo ago
+1 on this
DoggeSlapper
DoggeSlapper3mo ago
Use sub query
Mario564
Mario5643mo 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
DoggeSlapper3mo ago
ye that's usually handled with a subquery if u need too
Mario564
Mario5643mo ago
Because of that, PG recommends what Dogge said
DoggeSlapper
DoggeSlapper3mo 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
Mario5643mo ago
Yeah, offset isn't available in any engine for mutation queries
Want results from more Discord servers?
Add your server