You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
INDEX name (...) inside CREATE TABLE does not create an index #2607
INDEX name (...) inside CREATE TABLE is parsed, but no index is created. CREATE INDEX on the same column creates one.
Reproduced on develop (v4.20.0):
alasql('CREATE TABLE t1 (a INT, b INT, INDEX k1 (a))');alasql('SHOW INDEX FROM t1');// [] expected: one indexalasql.databases.alasql.indices;// {} expected: {k1: 't1'}alasql('CREATE TABLE t2 (a INT, b INT)');alasql('CREATE INDEX k2 ON t2 (a)');alasql('SHOW INDEX FROM t2');// [{hh: ..., len: 0}]alasql.databases.alasql.indices;// {k2: 't2'}
Cause
yy.CreateTable.prototype.execute (src/60createtable.js) handles the constraint types PRIMARY KEY, CHECK, UNIQUE and FOREIGN KEY. A constraint of type INDEX is skipped.
Direction
Register the index the way CREATE INDEX does: table.inddefs[name], table.indices[hh] and db.indices[name]. INSERT then keeps it up to date. With #2606, the columns can have a prefix length (INDEX k (a(10))).
Tests: SHOW INDEX, db.indices, and rows inserted after CREATE TABLE are found through the index.
Activity
Fix index creation in CREATE TABLE to close AlaSQL#2607 (AlaSQL#2614)