Issue 24139: Use sqlite3 extended error codes
Created on 2015-05-07 09:19 by Dima.Tisnek, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| 24139.patch | palaviv, 2016-08-30 18:19 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1108 | closed | palaviv, 2017-04-13 10:02 | |
| PR 28076 | merged | erlendaasland, 2021-08-30 21:11 | |
| PR 29382 | merged | erlendaasland, 2021-11-03 08:48 | |
| Messages (8) | |||
|---|---|---|---|
| msg242710 - (view) | Author: Dima Tisnek (Dima.Tisnek) * | Date: 2015-05-07 09:19 | |
Let's fetch extended error codes from SQLite, information contained is not particularly interesting to the user, but may be invaluable in debugging! http://www.sqlite.org/rescode.html https://sqlite.org/c3ref/extended_result_codes.html http://www.sqlite.org/c3ref/errcode.html Current behaviour: For example, consider that extended error was SQLITE_READONLY_DBMOVED, it would be set in https://github.com/mackyle/sqlite/blob/1caed0ecc62583c4f8a509ff66ae99b6939fe727/src/pager.c#L4836 without explicit detail string. Python will call sqlite3_errcode() which will strip extended information via `& errMask` in https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L2176 Python will then call sqlite3_errmsg(), and the error message will be according to truncated (simple) error per: https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1318 P.S. there are a few cases where sqlite3 internally sets both error code and message, in those cases, current Python module (presumably) reads out the error message correctly. For example https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1584 |
|||
| msg242714 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2015-05-07 13:41 | |
It seems reasonable to provide as much error information as is available, one way or another. Would you like to work on a patch? |
|||
| msg273949 - (view) | Author: Aviv Palivoda (palaviv) * | Date: 2016-08-30 18:19 | |
Attached is a patch to enable the extended error codes. This patch should be dependent on issue 16379. Without returning the sqlite error code in the exception the extended error code does not reveal any information not currently available. As you can see in https://github.com/mackyle/sqlite/blob/ebb27fe5bd5045d924d99cdd7dec9b7064c24768/src/main.c#L1318 there are messages only for the non-extended error codes and that is what is exposed now. |
|||
| msg274008 - (view) | Author: Dima Tisnek (Dima.Tisnek) * | Date: 2016-08-31 09:59 | |
Aviv the patch makes in itself. Are the changes in the other ticket needed to implement new tests? Or is it possible to include tests here? |
|||
| msg274009 - (view) | Author: Dima Tisnek (Dima.Tisnek) * | Date: 2016-08-31 10:02 | |
I meant "the patch makes sense in itself". |
|||
| msg274065 - (view) | Author: Aviv Palivoda (palaviv) * | Date: 2016-08-31 20:12 | |
> Are the changes in the other ticket needed to implement new tests? > Or is it possible to include tests here? It is not possible to add any tests to this issue before exposing the error code. I will implement new tests when issue 16379 will be resolved. > Aviv the patch makes in itself. I think that this issue should be dependent on issue 16379 as the behavior of the sqlite module will no be changed after this patch until issue 16379 is resolved. In addition there will be some "rebase" issues that will need to be solved. |
|||
| msg405569 - (view) | Author: Pablo Galindo Salgado (pablogsal) * ![]() |
Date: 2021-11-02 23:49 | |
New changeset 456e27ac0ac6bc1cfd6da0191bd7802d8667457b by Erlend Egeberg Aasland in branch 'main': bpo-24139: Add support for SQLite extended result codes (GH-28076) https://github.com/python/cpython/commit/456e27ac0ac6bc1cfd6da0191bd7802d8667457b |
|||
| msg405595 - (view) | Author: Ken Jin (kj) * ![]() |
Date: 2021-11-03 09:35 | |
New changeset 0dfb8c4afee65f9e185882efd57f7012120da74c by Erlend Egeberg Aasland in branch 'main': bpo-24139: Fix test_sqlite3 `test_extended_error_code_on_exception()` on s390x RHEL buildbots (GH-29382) https://github.com/python/cpython/commit/0dfb8c4afee65f9e185882efd57f7012120da74c |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:16 | admin | set | github: 68327 |
| 2021-11-03 09:35:46 | kj | set | nosy:
+ kj messages: + msg405595 |
| 2021-11-03 08:48:45 | erlendaasland | set | pull_requests: + pull_request27640 |
| 2021-11-02 23:52:46 | erlendaasland | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2021-11-02 23:49:46 | pablogsal | set | nosy:
+ pablogsal messages: + msg405569 |
| 2021-08-30 21:11:58 | erlendaasland | set | pull_requests: + pull_request26520 |
| 2020-12-18 22:33:55 | erlendaasland | set | nosy:
+ erlendaasland |
| 2019-06-07 00:00:51 | terry.reedy | set | pull_requests: - pull_request13749 |
| 2019-06-06 19:17:57 | taleinat | set | stage: patch review pull_requests: + pull_request13749 |
| 2017-04-13 10:02:14 | palaviv | set | pull_requests: + pull_request1249 |
| 2016-08-31 20:12:15 | palaviv | set | messages: + msg274065 |
| 2016-08-31 10:02:11 | Dima.Tisnek | set | messages: + msg274009 |
| 2016-08-31 09:59:52 | Dima.Tisnek | set | messages: + msg274008 |
| 2016-08-30 18:19:28 | palaviv | set | files:
+ 24139.patch nosy:
+ palaviv keywords: + patch |
| 2015-05-07 18:29:14 | ned.deily | set | nosy:
+ ghaering |
| 2015-05-07 13:41:18 | r.david.murray | set | nosy:
+ r.david.murray messages:
+ msg242714 |
| 2015-05-07 09:19:35 | Dima.Tisnek | create | |
