summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/dump.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2013-01-10 16:30:51 (GMT)
committerR David Murray <rdmurray@bitdance.com>2013-01-10 16:30:51 (GMT)
commitd618684d654bb5fc962624707721fc4793ed3801 (patch)
tree5f5ee47fd7337457fb472f4c1c3a79f26d8e47d8 /Lib/sqlite3/dump.py
parentec8f8f7959169593fe258a3792b498135af70701 (diff)
downloadcpython-d618684d654bb5fc962624707721fc4793ed3801.zip
cpython-d618684d654bb5fc962624707721fc4793ed3801.tar.gz
cpython-d618684d654bb5fc962624707721fc4793ed3801.tar.bz2
#15545: sort iterdump via SQL instead of in python code
Although there is not a regression in Python2, we make the same update here to keep the code bases in sync. (The fix for issue 9750 introduced a regression in Python 3 by sorting the row objects returned by fetchall. But if a row_factory such as sqlite3.Row is used, the rows may not be sortable (in Python3), which leads to an exception. The sorting is still a nice idea, so the patch moves the sort into the sql.) Fix and test by Peter Otten.
Diffstat (limited to 'Lib/sqlite3/dump.py')
-rw-r--r--Lib/sqlite3/dump.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/sqlite3/dump.py b/Lib/sqlite3/dump.py
index da6be68..de9c368 100644
--- a/Lib/sqlite3/dump.py
+++ b/Lib/sqlite3/dump.py
@@ -25,9 +25,10 @@ def _iterdump(connection):
FROM "sqlite_master"
WHERE "sql" NOT NULL AND
"type" == 'table'
+ ORDER BY "name"
"""
schema_res = cu.execute(q)
- for table_name, type, sql in sorted(schema_res.fetchall()):
+ for table_name, type, sql in schema_res.fetchall():
if table_name == 'sqlite_sequence':
yield('DELETE FROM "sqlite_sequence";')
elif table_name == 'sqlite_stat1':