gh-108590: Fix sqlite3 iterdump() for table columns containing invalid Unicode sequences#108683
gh-108590: Fix sqlite3 iterdump() for table columns containing invalid Unicode sequences#108683erlend-aasland wants to merge 4 commits intopython:mainfrom
Conversation
…e sequences This also reverts 400a1ce.
|
cc. @CorvinM |
|
Sorry 'bout the unneeded churn, Serhiy; I should have caught this earlier. |
serhiy-storchaka
left a comment
There was a problem hiding this comment.
It is still not good.
It modifies the input connection object, is not thread-safe, and even if iterdump() will no longer fail, you need a way to feed its result back to SQLite without errors. There will also be new encoding errors in attempt to save the dump in file or print to stdout.
|
For now, it may be easier to revert the previous changes and start to work on proper fix from clear page. |
Good point; Corvin added the context manager for this; let's throw that back in.
The underlying calls should take care of that; you cannot share a |
I agree; I'm reverting the previous change in |
There is no encoding errors when |
|
Does the recreation from dump work here? I was encountering encoding errors when attempting it with surrogateescape but not with the old chr() for some reason. |
|
Well, using the So the fix is valid, technically. But from a user perspective; requiring the user to pass |
|
Yes, I can recreate it with this: Apart from the preamble and table name quoting, they're equal. The VALUES string is |
|
|
|
Unless I did something wrong I think this PR will fail the test I posted but works for print() What do you think about breaking consistency with sqlite cli for 3.11, 3.12 and just dumping |
|
FTR, with #108695 and the recreation sequence outlined in #108683 (comment), I'm not able to recreate the database. The resulting VALUES string becomes: |
Both correct.
I'm not sure if it is worth it for this corner case. At the moment, I think this may be best solved in documentation. Let's think about it for some days; there is no hurry in getting this fixed. |
|
Thanks for helping investigate this, @CorvinM. |
This partially reverts 400a1ce, except for the test, which is amended.