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

INTEGER value formatting incompatible with SQLite #114

Closed
penberg opened this issue Jul 10, 2024 · 1 comment · Fixed by #115
Closed

INTEGER value formatting incompatible with SQLite #114

penberg opened this issue Jul 10, 2024 · 1 comment · Fixed by #115
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@penberg
Copy link
Owner

penberg commented Jul 10, 2024

The cross-join test fails with SQLite because we print out the age column in wrong format:

penberg@vonneumann limbo % SQLITE_EXEC=sqlite3 ./testing/all.test
Running test: cross-join
Test FAILED: 'select * from users, products limit 1;'
returned '1|Jamie|Foster|dylan00@example.com|496-522-9493|62375 Johnson Rest Suite 322|West Lauriestad|IL|35865|94|1|hat|79.0'
expected '1|Jamie|Foster|dylan00@example.com|496-522-9493|62375 Johnson Rest Suite 322|West Lauriestad|IL|35865|94|1|hat|79'
@penberg penberg added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Jul 10, 2024
@pereman2
Copy link
Collaborator

pereman2 commented Jul 10, 2024

@penberg time to talk about affinities. #114 this is due to affinity of values where 79.0 was optimzied as a u8 on disk and then treated as integer on getting a record from a Page.
thankfully fix here is simple so I will add it :):

      /* If the column has REAL affinity, it may currently be stored as an
      ** integer. Use OP_RealAffinity to make sure it is really real.
      **
      ** EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to
      ** floating point when extracting it from the record.  */
      if( iCol>=0 && pTab->aCol[iCol].affinity==SQLITE_AFF_REAL ){
        sqlite3VdbeAddOp1(v, OP_RealAffinity, target);
      }

in the future we might want to separate data type and affinity type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants