Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix MustBeInt opcode semantics #706

Merged
merged 1 commit into from
Jan 15, 2025
Merged

Conversation

psvri
Copy link
Contributor

@psvri psvri commented Jan 15, 2025

In sqlite3 , we can create primary key with only integer column and during insert we can pass any value which can be parsed into integer as shown below. When I tried the same with limbo, it failed. The cause of this was due to MustBeInt opcode behaviour not aligned with sqlite. This PR aims to fix it.

Sqlite output

SQLite version 3.45.3
sqlite> create table temp (t1 integer, primary key (t1));
sqlite> insert into temp values (1),(2.0),('3'),('4.0');
sqlite> select * from temp;
1
2
3
4

Limbo output main branch

limbo>     create table temp (t1 integer, primary key (t1));
limbo>     insert into temp values (1),(2.0),('3'),('4.0');
Parse error: MustBeInt: the value in the register is not an integer
limbo>     select * from temp;
1

Limbo output with this PR

limbo> create table temp (t1 integer, primary key (t1));
limbo> insert into temp values (1),(2.0),('3'),('4.0');
limbo> select * from temp;
1
2
3
4

@penberg penberg changed the title Align MustBeInt logic with sqlite Fix MustBeInt opcode semantics Jan 15, 2025
@penberg penberg merged commit b589203 into tursodatabase:main Jan 15, 2025
37 checks passed
@psvri psvri deleted the fix_mbi_2 branch January 16, 2025 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants