Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-12336

Ensure Predicate::Set is passed the right thing before passing it to the DB

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2022-06-07
    • None
    • Edit search
    • None

      See the issue below - we should ensure we're passing ints before passing them to the SQL. If we're not sure Predicate::Set will ever only want ints, we could create a Predicate::IntSet.

      Sentry Issue: MUSICBRAINZ-SERVER-R5

      None: DBD::Pg::st execute failed: ERROR:  invalid input syntax for type smallint: "245'"
      LINE 2: ... edit.id = edit_data.edit WHERE ((edit.type = any('{"5","245...
                                                                   ^ [for Statement "
                  WITH x AS (SELECT edit.*, edit_data.data FROM edit JOIN edit_data ON edit.id = edit_data.edit WHERE ((edit.type = any(?)))
               
               ORDER BY edit.id DESC
               LIMIT 500 OFFSET ?)
                  SELECT x.*, c.count AS total_row_count
                  FROM x, (SELECT count(*) FROM x) c
               LIMIT ?" with ParamValues: 1='{"5","245'"}', 2='0', 3='50']
        File "Connector.pm", line 50, in Sql::select_list_of_hashes
          $exception->throw( sqlstate => $state, message => decode_utf8($msg) );
        File "QueryToList.pm", line 80, in MusicBrainz::Server::Data::Role::QueryToList::query_to_list_limited
          } @{$self->c->sql->select_list_of_hashes($query, @args)};
        File "Edit.pm", line 101, in MusicBrainz::Server::Data::Edit::run_query
          $self->query_to_list_limited(
        File "Edit.pm", line 300, in MusicBrainz::Server::Controller::Edit::__ANON__
          return $c->model('Edit')->run_query($query, shift, shift);
        File "Controller.pm", line 244, in MusicBrainz::Server::Controller::_load_paged
          my ($data, $total) = $loader->($LIMIT, ($page - 1) * $LIMIT);
      ...
      (7 additional frame(s) were not displayed)
      

            reosarevok Nicolás Tamargo
            dev-sentry Dev through Sentry
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2022-06-07