[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

Erlend Egeberg Aasland report at bugs.python.org
Sat Feb 20 16:54:08 EST 2021


Erlend Egeberg Aasland <erlend.aasland at innova.no> added the comment:

"SELECT 1" yields "1" as column name.
"SELECT <...> AS N" yields "N" as column name.
"SELECT NULL" yields "NULL" as column name.

We can't set the column name via the API, so that's pretty much it (implicit name or explicit through the AS keyword). As long as sqlite3_prepare_v2() returned SQLITE_OK, it seems that SQLite assures we've got a valid column name.

As far as I can sqlite3_column_name() returns NULL if:
1) The first parameter (stmt) is NULL
2) The second parameter is out of bounds
3) Memory error
4) No column name is set (SQLite bug)

We've got 1) and 2) covered. SQLite has a pretty good code coverage, so I'd say 4) is unlikely.

What do you think?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43251>
_______________________________________


More information about the Python-bugs-list mailing list