-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SQLite UPDATE...RETURNING sets NOT NULL column as nullable #2939
Labels
Comments
tyrelr
added a commit
to tyrelr/sqlx
that referenced
this issue
Feb 18, 2024
tyrelr
added a commit
to tyrelr/sqlx
that referenced
this issue
Feb 18, 2024
tyrelr
added a commit
to tyrelr/sqlx
that referenced
this issue
Feb 18, 2024
Merged
tyrelr
added a commit
to tyrelr/sqlx
that referenced
this issue
Apr 20, 2024
I am the author and fixer of #2407 which is related but slightly different. That fix handles proving that is_active is not null which is enough for inserts but in the case of updates, as you observed, misses the id field.
There is not a heuristic in the code to prove that id is not null but I think it is possible from these ops.
|
abonander
pushed a commit
that referenced
this issue
May 31, 2024
* convert logger to output a query graph * avoid duplicating branch paths to shrink output graph * separate different branching paths * include all branches which found unique states * track the reason for ending each branches execution * track the result type of each branch * make edges rely on history index instead of program_id, to avoid errors when looping * add state diff to query graph * drop redundant table info * rework graph to show state changes, rework logger to store state snapshots * show state on the previous operation * gather duplicate state changes into clusters to reduce repetition * draw invisible connections between unknown instructions by program_i * clean up dot format string escaping * add test case from #1960 (update returning all columns) * add tests for #2939 (update returning only the PK column) * allow inserting into a table using only the index * improve null handling of IfNull, fix output type of NewRowId * add NoResult nodes for branches which don't log a result, as a sanity check * add short-circuit to all logging operations * remove duplicate logging checks, and make logging enabled/disabled consistently depend on sqlx::explain instead of sqlx for capture & sqlx::explain for output * add failing test for awkwardly nested/filtered count subquery * handle special case of return operation to fix failing test * require trace log level instead of using whatever log level statement logging was configured to use
jayy-lmao
pushed a commit
to jayy-lmao/sqlx
that referenced
this issue
Jun 6, 2024
* convert logger to output a query graph * avoid duplicating branch paths to shrink output graph * separate different branching paths * include all branches which found unique states * track the reason for ending each branches execution * track the result type of each branch * make edges rely on history index instead of program_id, to avoid errors when looping * add state diff to query graph * drop redundant table info * rework graph to show state changes, rework logger to store state snapshots * show state on the previous operation * gather duplicate state changes into clusters to reduce repetition * draw invisible connections between unknown instructions by program_i * clean up dot format string escaping * add test case from launchbadge#1960 (update returning all columns) * add tests for launchbadge#2939 (update returning only the PK column) * allow inserting into a table using only the index * improve null handling of IfNull, fix output type of NewRowId * add NoResult nodes for branches which don't log a result, as a sanity check * add short-circuit to all logging operations * remove duplicate logging checks, and make logging enabled/disabled consistently depend on sqlx::explain instead of sqlx for capture & sqlx::explain for output * add failing test for awkwardly nested/filtered count subquery * handle special case of return operation to fix failing test * require trace log level instead of using whatever log level statement logging was configured to use
jrasanen
pushed a commit
to jrasanen/sqlx
that referenced
this issue
Oct 14, 2024
* convert logger to output a query graph * avoid duplicating branch paths to shrink output graph * separate different branching paths * include all branches which found unique states * track the reason for ending each branches execution * track the result type of each branch * make edges rely on history index instead of program_id, to avoid errors when looping * add state diff to query graph * drop redundant table info * rework graph to show state changes, rework logger to store state snapshots * show state on the previous operation * gather duplicate state changes into clusters to reduce repetition * draw invisible connections between unknown instructions by program_i * clean up dot format string escaping * add test case from launchbadge#1960 (update returning all columns) * add tests for launchbadge#2939 (update returning only the PK column) * allow inserting into a table using only the index * improve null handling of IfNull, fix output type of NewRowId * add NoResult nodes for branches which don't log a result, as a sanity check * add short-circuit to all logging operations * remove duplicate logging checks, and make logging enabled/disabled consistently depend on sqlx::explain instead of sqlx for capture & sqlx::explain for output * add failing test for awkwardly nested/filtered count subquery * handle special case of return operation to fix failing test * require trace log level instead of using whatever log level statement logging was configured to use
jrasanen
pushed a commit
to jrasanen/sqlx
that referenced
this issue
Oct 14, 2024
* convert logger to output a query graph * avoid duplicating branch paths to shrink output graph * separate different branching paths * include all branches which found unique states * track the reason for ending each branches execution * track the result type of each branch * make edges rely on history index instead of program_id, to avoid errors when looping * add state diff to query graph * drop redundant table info * rework graph to show state changes, rework logger to store state snapshots * show state on the previous operation * gather duplicate state changes into clusters to reduce repetition * draw invisible connections between unknown instructions by program_i * clean up dot format string escaping * add test case from launchbadge#1960 (update returning all columns) * add tests for launchbadge#2939 (update returning only the PK column) * allow inserting into a table using only the index * improve null handling of IfNull, fix output type of NewRowId * add NoResult nodes for branches which don't log a result, as a sanity check * add short-circuit to all logging operations * remove duplicate logging checks, and make logging enabled/disabled consistently depend on sqlx::explain instead of sqlx for capture & sqlx::explain for output * add failing test for awkwardly nested/filtered count subquery * handle special case of return operation to fix failing test * require trace log level instead of using whatever log level statement logging was configured to use
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Description
If I take the following test from main and change the WHERE clause to match on
id
instead ofname
, it fails. The returnedid
column should not be nullable, regardless.sqlx/tests/sqlite/describe.rs
Lines 270 to 282 in 929af41
Minimal Reproduction
From setup.sql:
Info
rustc --version
: rustc 1.74.0 (79e9716c9 2023-11-13)The text was updated successfully, but these errors were encountered: