Guarantee on returning order
Is there a guarantee that
await db.insert(sometable).values(someArray).returning()
will always return in the same order as someArray2 Replies
Drizzle doesn't change of affects the return order in any way. This is something to check in the database documentation
For sqlite it seems to not guarantee this "The output order for the RETURNING rows is arbitrary and is not necessarily related to the order in which the rows were processed internally." https://www.sqlite.org/lang_returning.html
Trying to figure out how I can insert bulk data into a parent and child table when I'm letting the DB create the ids. I thought I could first insert into one with returning and then use the ids returned from that in the second to reference it, but it seems to not match up correctly