Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

TCL test on insert misbehaves #434

Open
krishvishal opened this issue Dec 11, 2024 · 0 comments
Open

TCL test on insert misbehaves #434

krishvishal opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working compat help wanted Extra attention is needed

Comments

@krishvishal
Copy link
Contributor

Put the following code in insert.test and call make test to reproduce the bug.

#!/usr/bin/env tclsh

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_execsql_test insert-basic-create {
    CREATE TABLE test_table ( id INTEGER PRIMARY KEY, name TEXT, value INTEGER);
} {}

do_execsql_test insert-basic-insert {
    INSERT INTO test_table (id, name, value) VALUES (NULL, 'test item', 43);
} {}

do execsql_test insert-basic-select {
    SELECT id, name, value FROM test_table WHERE name = 'test item';
} {1|test item|43}

This results in the following error:

Running test: insert-basic-create
Running test: insert-basic-insert
Corrupt database: Parse error: no such table: test_table
    while executing
"exec {*}$command"
    (procedure "evaluate_sql" line 3)
    invoked from within
"evaluate_sql $sqlite_exec $sql"
    (procedure "run_test" line 2)
    invoked from within
"run_test $::sqlite_exec $combined_sql $combined_expected_output"
    (procedure "do_execsql_test" line 5)
    invoked from within
"do_execsql_test insert-basic-insert {
    INSERT INTO test_table (id, name, value) VALUES (NULL, 'test item', 43);
} {}"
    (file "./testing/insert.test" line 11)
make: *** [Makefile:64: test-compat-insert] Error 1

Expected behavior: being able to INSERT into database and successfully perform SELECT operation to get the previous INSERT's row.

Check SQLite source for more info: https://github.com/sqlite/sqlite/blob/master/test/e_insert.test#L42

@penberg penberg added bug Something isn't working help wanted Extra attention is needed compat labels Dec 11, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working compat help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants