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
For tables with primary key constraints that had their data set using example_db.tables.example_table.data = []; , running an update statement is throwing an error for me. I'll attach pseudo-code below, and here's a link to an example on jsfiddle: https://jsfiddle.net/0wmhx149/15/
Updating data with no pk works fine:
// pseudo-code
a = new alasql.Database();
a.exec("create table with no pk");
a.tables.table.data = [ some data ] ;
a.exec("update table");
// update runs correctly
Updating data with pk works fine if using insert statements:
// pseudo-code
a = new alasql.Database();
a.exec("create table with no pk");
a.exec("insert some data");
a.exec("update table");
// update runs correctly
Updating data with pk and direct assignment fails
// pseudo-code
a = new alasql.Database();
a.exec("create table with pk");
a.tables.table.data = [ some data ] ;
a.exec("update table");
// update throws an error
The error is Something wrong with index on table
Two obvious workarounds are
Don't use PKs
Don't directly assign data
The text was updated successfully, but these errors were encountered:
Hello @mathiasrw , I did a little debugging on this issue.
While debugging, I noticed the following behavior when we assign data directly:
It replaces the entire data in the table variable.
It does not assign the uniqs attribute, which is required when performing table.update.
Below is an example of the table data when using exec followed by directly assigning data.
For tables with primary key constraints that had their data set using
example_db.tables.example_table.data = [];
, running an update statement is throwing an error for me. I'll attach pseudo-code below, and here's a link to an example on jsfiddle: https://jsfiddle.net/0wmhx149/15/Updating data with no pk works fine:
Updating data with pk works fine if using insert statements:
Updating data with pk and direct assignment fails
The error is
Something wrong with index on table
Two obvious workarounds are
The text was updated successfully, but these errors were encountered: