Skip to content

[bug]: Mission review search gives PG::AmbiguousColumn error #1042

Description

@MMK21Hub

what happened?

Entering a text search query on the mission review dashboard gives a 500 error

what did you expect to happen?

to search

how do we make it happen?

  1. be an admin
  2. go to https://stardance.hackclub.com/admin/missions/web-os-1/submissions?status=approved&search=S

show us!

ActionView::Template::Error
PG::AmbiguousColumn: ERROR: column reference "created_at" is ambiguous LINE 1: ...cts.title ILIKE $5) ORDER BY COALESCE(pending_at, created_at... ^

/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:169:in 'PG::Connection#exec_params'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:169:in 'ActiveRecord::ConnectionAdapters::PostgreSQL::DatabaseStatements#perform_query'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:571:in 'block (2 levels) in ActiveRecord::ConnectionAdapters::DatabaseStatements#raw_execute'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:1086:in 'block in ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
/usr/local/bundle/ruby/3.4.0/gems/activesupport-8.1.3.1/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:1055:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#with_raw_connection'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:570:in 'block in ActiveRecord::ConnectionAdapters::DatabaseStatements#raw_execute'
/usr/local/bundle/ruby/3.4.0/gems/activesupport-8.1.3.1/lib/active_support/notifications/instrumenter.rb:58:in 'ActiveSupport::Notifications::Instrumenter#instrument'
/usr/local/bundle/ruby/3.4.0/gems/sentry-rails-6.6.2/lib/sentry/rails/tracing.rb:56:in 'Sentry::Rails::Tracing::SentryNotificationExtension#instrument'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract_adapter.rb:1206:in 'ActiveRecord::ConnectionAdapters::AbstractAdapter#log'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:569:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#raw_execute'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:613:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#internal_execute'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#internal_exec_query'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:708:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#select'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/database_statements.rb:76:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#select_all'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/query_cache.rb:275:in 'block in ActiveRecord::ConnectionAdapters::QueryCache#select_all'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/query_cache.rb:313:in 'block (2 levels) in ActiveRecord::ConnectionAdapters::QueryCache#cache_sql'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/query_cache.rb:90:in 'ActiveRecord::ConnectionAdapters::QueryCache::Store#compute_if_absent'
/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.1.3.1/lib/active_record/connection_adapters/abstract/query_cache.rb:311:in 'block in ActiveRecord::ConnectionAdapters::QueryCache#cache_sql'
/usr/local/bundle/ruby/3.4.0/gems/activesupport-8.1.3.1/lib/active_support/concurrency/null_lock.rb:9:in 'ActiveSupport::Concurrency::NullLock#synchronize'

Reference code d609b7037db444ed8c023829bf5173a0

where were you?

No response

links

notes

This doesn't happen if your query returns 0 results

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions