Project

General

Profile

Bug #12643

Smart variable/class param free text search throws "no such column: lookup_values.value" error

Added by Dominic Cleal over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When on the smart variables or smart class parameters index pages, entering any free text search fails with the following error:

SQLite3::SQLException: no such column: lookup_values.value: SELECT  "lookup_keys"."puppetclass_id" FROM "lookup_keys"  WHERE "lookup_keys"."type" IN ('VariableLookupKey') AND (("lookup_keys"."key" LIKE '%test%' OR "lookup_values"."value" LIKE '%test%' OR "puppetclasses"."name" LIKE '%test%')) ORDER BY "lookup_keys"."key" ASC LIMIT 40 OFFSET 0

It appears that the scoped search from lookup keys to values isn't actually joining the tables.


Related issues

Has duplicate Foreman - Bug #13034: SQL error when searching for smart class parameterDuplicate2016-01-07
Has duplicate Foreman - Bug #13105: Search in Smart Class Parameter yields PGErrorDuplicate2016-01-11

Associated revisions

Revision 0e9b35eb (diff)
Added by Tomer Brisker over 3 years ago

Fixes #12644, #12643 - Correctly authorize in lookup key index

There was a problem with the authorizer for lookup key indices that led
to problems with sorting and searching.
Because `#includes` lazy loads the included relation, and the authorizer
didn't need the relation, it didn't load the puppetclass or the
lookup_value table. However, the search_for scope added an order_by or a
where condition to @lookup_keys, which caused the authorizer collection
to create an invalid query.

Revision 5e77d766 (diff)
Added by Tomer Brisker over 3 years ago

Fixes #12644, #12643 - Correctly authorize in lookup key index

There was a problem with the authorizer for lookup key indices that led
to problems with sorting and searching.
Because `#includes` lazy loads the included relation, and the authorizer
didn't need the relation, it didn't load the puppetclass or the
lookup_value table. However, the search_for scope added an order_by or a
where condition to @lookup_keys, which caused the authorizer collection
to create an invalid query.

(cherry picked from commit 0e9b35eb264ebfd7630aca7eba72213c6d5a9fa1)

History

#1 Updated by Tomer Brisker over 3 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Tomer Brisker
  • Pull request https://github.com/theforeman/foreman/pull/2958 added

#2 Updated by Anonymous over 3 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Dominic Cleal over 3 years ago

  • Legacy Backlogs Release (now unused) set to 104

#4 Updated by Dominic Cleal over 3 years ago

  • Has duplicate Bug #13034: SQL error when searching for smart class parameter added

#5 Updated by Dominic Cleal over 3 years ago

  • Has duplicate Bug #13105: Search in Smart Class Parameter yields PGError added

Also available in: Atom PDF