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 SQL error in refresh_assets caused by 5b14fe #4250

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

Martchus
Copy link
Contributor

Otherwise the asset cleanup fails due to an SQL error:

DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR:  invalid input syntax for type boolean: "" [for Statement "UPDATE assets SET fixed = ?, t_updated = ? WHERE id = ?" with ParamValues: 1='', 2='2021-09-28 15:01:21', 3='27487345'] at /usr/share/openqa/script/../lib/OpenQA/Schema/ResultSet/Assets.pm line 99

Apparently DBIx cannot cope with the boolean here so one
has to convert to int manually.

See https://progress.opensuse.org/issues/97979#note-26

Otherwise the asset cleanup fails due to an SQL error:

```
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR:  invalid input syntax for type boolean: "" [for Statement "UPDATE assets SET fixed = ?, t_updated = ? WHERE id = ?" with ParamValues: 1='', 2='2021-09-28 15:01:21', 3='27487345'] at /usr/share/openqa/script/../lib/OpenQA/Schema/ResultSet/Assets.pm line 99
```

Apparently DBIx cannot cope with the boolean here so one
has to convert to int manually.

See https://progress.opensuse.org/issues/97979#note-26
@@ -95,7 +95,7 @@ sub refresh_assets {
my ($self) = @_;

while (my $asset = $self->next) {
my $is_fixed = $asset->is_fixed;
my $is_fixed = $asset->is_fixed ? 1 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should be changed in the sub is_fixed directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should only be required here but I can also change is_fixed itself.

@codecov
Copy link

codecov bot commented Sep 28, 2021

Codecov Report

Merging #4250 (cfe6f19) into master (44df680) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4250   +/-   ##
=======================================
  Coverage   97.92%   97.92%           
=======================================
  Files         369      369           
  Lines       33421    33426    +5     
=======================================
+ Hits        32726    32732    +6     
+ Misses        695      694    -1     
Impacted Files Coverage Δ
lib/OpenQA/Schema/ResultSet/Assets.pm 100.00% <100.00%> (ø)
t/15-assets.t 100.00% <100.00%> (ø)
t/lib/OpenQA/Test/Utils.pm 81.87% <0.00%> (-0.30%) ⬇️
lib/OpenQA/Worker/WebUIConnection.pm 94.11% <0.00%> (+0.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44df680...cfe6f19. Read the comment docs.

@okurz okurz merged commit b740af5 into os-autoinst:master Sep 29, 2021
@Martchus Martchus deleted the sql-error branch September 29, 2021 08:28
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.

4 participants