-
Notifications
You must be signed in to change notification settings - Fork 1.1k
export() resets foreign key pragma #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have commented a similar question in other thread. Hope it helps. |
Your comment seems to be about the fact that the export does not contain the pragma information, right? That matches the sqlite behavior and is understandable to me. What I'm surprised about is that doing an export changes the pragma for my existing connection. |
@karlb yes you are right, your case is very strange. I would try to reproduce that behaviour using the online sql gui to assure my code has not errors. |
[time machine noises] This is happening because the export function closes the database file before it’s read into an Uint8Array and then opened again: Lines 866 to 868 in 5c40349
A newly-opened database doesn’t come with prior pragmas. Could this be documented in the export function, or would it be possible to export the database without closing and re-opening it? On a related note, I’ve been wondering which pragmas (especially locking_mode and journal_mode) make sense for sql.js since everything is happening in memory buffers anyway? |
Yes, we've discussed that in #397 |
I am going to close this issue as a duplicate of #159 |
@lovasoa Makes sense! I’ll read up on those two issues. |
When calling
export()
on a database, foreign keys are turned off. I would expectPRAGMA foreign_keys
to return the same value before and after an export. Generally, I would expect export not to change the state of the db at all.Example from developer console:
The text was updated successfully, but these errors were encountered: