ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR: function lower(integer) does not exist

https://sentry.gitlab.net/gitlab/gitlabcom/issues/741976/

PG::UndefinedFunction: ERROR:  function lower(integer) does not exist
LINE 1: ...ce_type" = 'Project' WHERE ((LOWER(routes.path) = LOWER(7158...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

  active_record/connection_adapters/postgresql_adapter.rb:624:in `async_exec_params'
    @connection.exec_params(sql, type_casted_binds)
  active_record/connection_adapters/postgresql_adapter.rb:624:in `block (2 levels) in exec_no_cache'
    @connection.exec_params(sql, type_casted_binds)
  active_support/dependencies/interlock.rb:46:in `block in permit_concurrent_loads'
    yield
  active_support/concurrency/share_lock.rb:185:in `yield_shares'
    yield
  active_support/dependencies/interlock.rb:45:in `permit_concurrent_loads'
    @lock.yield_shares(compatible: [:load]) do
...
(79 additional frame(s) were not displayed)

ActiveRecord::StatementInvalid: PG::UndefinedFunction: ERROR:  function lower(integer) does not exist
LINE 1: ...ce_type" = 'Project' WHERE ((LOWER(routes.path) = LOWER(7158...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
: SELECT  "projects".* FROM "projects" INNER JOIN "routes" ON "routes"."source_id" = "projects"."id" AND "routes"."source_type" = 'Project' WHERE ((LOWER(routes.path) = LOWER(7158450))) ORDER BY (CASE WHEN  routes.path = 7158450 THEN 0 ELSE 1 END) LIMIT 1

PG::UndefinedFunction: ERROR:  function lower(integer) does not exist
LINE 1: ...ce_type" = 'Project' WHERE ((LOWER(routes.path) = LOWER(7158...
                                                             ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
: SELECT  "projects".* FROM "projects" INNER JOIN "routes" ON "routes"."source_id" = "projects"."id" AND "routes"."source_type" = 'Project' WHERE ((LOWER(routes.path) = LOWER(7158450))) ORDER BY (CASE WHEN  routes.path = 7158450 THEN 0 ELSE 1 END) LIMIT 1
Assignee Loading
Time tracking Loading