aboutsummaryrefslogtreecommitdiff
path: root/src/sqliteLimit.h
diff options
context:
space:
mode:
authordrh <>2025-02-21 20:35:37 +0000
committerdrh <>2025-02-21 20:35:37 +0000
commitcc803b209f2ffa9dcaad43c37eb8ccafaed199bd (patch)
treed58455eecf8e403f2ecf00a75fb28a22f8d23a2d /src/sqliteLimit.h
parentd9959bf48b13bffda4c073de17eb13752b9cb5c9 (diff)
downloadsqlite-cc803b209f2ffa9dcaad43c37eb8ccafaed199bd.tar.gz
sqlite-cc803b209f2ffa9dcaad43c37eb8ccafaed199bd.zip
The number of declared columns in an index is limited to SQLITE_LIMIT_COLUMN.
But the actual number of columns in the implementation might need to be twice as much to account for the primary key at the end. Ensure that the code is able to deal with this. This is a correction to check-in [d7729dbbf231d57c]. FossilOrigin-Name: 5822feec43be9352fd87bf9968c39c0218e01ab5fe3ba50431ae21cba79e6c89
Diffstat (limited to 'src/sqliteLimit.h')
-rw-r--r--src/sqliteLimit.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sqliteLimit.h b/src/sqliteLimit.h
index 0d15b3182..ec774889b 100644
--- a/src/sqliteLimit.h
+++ b/src/sqliteLimit.h
@@ -41,6 +41,12 @@
** not have more than a dozen or so columns in any table. And if
** that is the case, there is no point in having more than a few
** dozen values in any of the other situations described above.
+**
+** An index can only have SQLITE_MAX_COLUMN columns from the user
+** point of view, but the underlying b-tree that implements the index
+** might have up to twice as many columns in a WITHOUT ROWID table,
+** since must also store the primary key at the end. Hence the
+** column count for Index is u16 instead of i16.
*/
#if !defined(SQLITE_MAX_COLUMN)
# define SQLITE_MAX_COLUMN 2000