Skip to content

ALTER TABLE ADD COLUMN does not work #1107

Description

@Serge-SDL

Hello,

I'm using alasql for a while now without problem, but for the first time I need to une ALTER TABLE queries and I got an issue.

my code:

    alasql.promise([
        'CREATE localStorage DATABASE IF NOT EXISTS Main',
        'ATTACH localStorage DATABASE Main',
        'Use Main',
        "CREATE TABLE test (language INT, hello STRING)",
        "INSERT INTO test VALUES (1,'Hello!')",
        "INSERT INTO test VALUES (2,'Aloha!')",
        "INSERT INTO test VALUES (3,'Bonjour!')",
        'ALTER TABLE test ADD COLUMN aaa STRING',
        "INSERT INTO test VALUES (4,'Hello!','xxxx')",
        "SELECT * FROM test WHERE language > 1"
    ]).then(function(res){
        console.log('Results from all queries:',res);
    }).catch(function(reason){
        console.log('Error:',reason);
    });

just a test function to see if ALTER woks.

the result is an array with only "1" in it, except the last element:
0: {language: 2, hello: "Aloha!"}
1: {language: 3, hello: "Bonjour!"}
2: {language: 4, hello: "Hello!"}

-> I don't get the new column value!
-> If I look at the structure on localStorage there is only the 2 first columns, not the newly created one.

Looks like ADD COLUMN do nothing...

can you help me?
thanks! :)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions