1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

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
This commit is contained in:
drh
2025-02-21 20:35:37 +00:00
parent d9959bf48b
commit cc803b209f
7 changed files with 49 additions and 31 deletions

View File

@ -493,18 +493,27 @@ ifcapable altertable {
#
reset_db
sqlite3_limit db SQLITE_LIMIT_COLUMN 8
do_catchsql_test 16.1 {
do_execsql_test 16.1 {
CREATE TABLE t1(
c1,c2,c3,c4,c5,c6,c7,c8,
PRIMARY KEY(c1,c2,c1 COLLATE NOCASE)
) WITHOUT ROWID;
} {1 {too many columns on sqlite_autoindex_t1_1}}
do_catchsql_test 16.2 {
CREATE TABLE t1(
} {}
do_execsql_test 16.2 {
CREATE TABLE t2(
c1,c2,c3,c4,c5,c6,c7,c8,
PRIMARY KEY(c1 COLLATE nocase,c1 COLLATE rtrim,
c2 COLLATE nocase,c2 COLLATE rtrim,
c3 COLLATE nocase,c3 COLLATE rtrim,
c4 COLLATE nocase,c4 COLLATE rtrim)
) WITHOUT ROWID;
} {}
do_execsql_test 16.3 {
CREATE TABLE t3(
c1,c2,c3,c4,c5,c6,c7,c8,
PRIMARY KEY(c1,c2),
UNIQUE(c3,c4,c5,c6,c7,c8,c3 COLLATE nocase)
) WITHOUT ROWID;
} {1 {too many columns on sqlite_autoindex_t1_2}}
} {}
finish_test