This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author erlendaasland
Recipients berker.peksag, erlendaasland, serhiy.storchaka
Date 2021-09-19.22:35:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632090954.41.0.8887678667.issue45243@roundup.psfhosted.org>
In-reply-to
Content
I propose to add wrappers for the SQLite sqlite3_limit() C API. Using this API, it is possible to query and set limits on a connection basis. This will make it easier (and faster) to test various corner cases in the test suite without relying on test.support.bigmemtest.


Quoting from the SQLite sqlite3_limit() docs:

  Run-time limits are intended for use in applications that manage both their
  own internal database and also databases that are controlled by untrusted
  external sources. An example application might be a web browser that has its
  own databases for storing history and separate databases controlled by
  JavaScript applications downloaded off the Internet. The internal databases
  can be given the large, default limits. Databases managed by external
  sources can be given much smaller limits designed to prevent a denial of
  service attack.


See also:
  - https://sqlite.org/c3ref/limit.html
  - https://sqlite.org/c3ref/c_limit_attached.html
  - https://sqlite.org/limits.html


Limit categories (C&P from SQLite docs)
---------------------------------------

SQLITE_LIMIT_LENGTH
The maximum size of any string or BLOB or table row, in bytes.

SQLITE_LIMIT_SQL_LENGTH
The maximum length of an SQL statement, in bytes.

SQLITE_LIMIT_COLUMN
The maximum number of columns in a table definition or in the result set of a SELECT or the maximum number of columns in an index or in an ORDER BY or GROUP BY clause.

SQLITE_LIMIT_EXPR_DEPTH
The maximum depth of the parse tree on any expression.

SQLITE_LIMIT_COMPOUND_SELECT
The maximum number of terms in a compound SELECT statement.

SQLITE_LIMIT_VDBE_OP
The maximum number of instructions in a virtual machine program used to implement an SQL statement. If sqlite3_prepare_v2() or the equivalent tries to allocate space for more than this many opcodes in a single prepared statement, an SQLITE_NOMEM error is returned.

SQLITE_LIMIT_FUNCTION_ARG
The maximum number of arguments on a function.

SQLITE_LIMIT_ATTACHED
The maximum number of attached databases.

SQLITE_LIMIT_LIKE_PATTERN_LENGTH
The maximum length of the pattern argument to the LIKE or GLOB operators.

SQLITE_LIMIT_VARIABLE_NUMBER
The maximum index number of any parameter in an SQL statement.

SQLITE_LIMIT_TRIGGER_DEPTH
The maximum depth of recursion for triggers.

SQLITE_LIMIT_WORKER_THREADS
The maximum number of auxiliary worker threads that a single prepared statement may start.
History
Date User Action Args
2021-09-19 22:35:54erlendaaslandsetrecipients: + erlendaasland, berker.peksag, serhiy.storchaka
2021-09-19 22:35:54erlendaaslandsetmessageid: <1632090954.41.0.8887678667.issue45243@roundup.psfhosted.org>
2021-09-19 22:35:54erlendaaslandlinkissue45243 messages
2021-09-19 22:35:54erlendaaslandcreate