Bug 745245

Summary: Filter on provider page fails with postgres error
Product: Red Hat Satellite Reporter: Jeff Weiss <jweiss>
Component: WebUIAssignee: Amos Benari <abenari>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: austinpatrick711, bbuckingham, bkearney, dajohnso, ohadlevy
Target Milestone: UnspecifiedKeywords: Regression
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-22 18:00:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 747354    

Description Jeff Weiss 2011-10-11 18:47:16 UTC
Description of problem:


Version-Release number of selected component (if applicable):
katello-0.1.92-1.git.0.657d7d5.fc14.noarch

How reproducible:


Steps to Reproduce:
1. Go to custom provider page
2. In filter box, type "blah", press Enter
3. 
  
Actual results:
Error:

    PGError: ERROR: column reference "name" is ambiguous LINE 1: ...ECT DISTINCT ON ("providers".id) "providers".id, name AS al... ^ : SELECT * FROM (SELECT DISTINCT ON ("providers".id) "providers".id, name AS alias_0 FROM "providers" LEFT OUTER JOIN "products" ON "products"."provider_id" = "providers"."id" WHERE "providers"."organization_id" = 1 AND "providers"."provider_type" = 'Custom' AND (("providers"."name" ILIKE '%blah%' OR "providers"."description" ILIKE '%blah%' OR "products"."name" ILIKE '%blah%' OR "products"."description" ILIKE '%blah%'))) AS id_list ORDER BY id_list.alias_0 LIMIT 25



Expected results:
results are filtered, no results shown (unless you have a provider named blah).


Additional info:

Comment 1 Brad Buckingham 2011-10-12 14:44:01 UTC
This appears to be an issue in the scoped_search gem generating invalid SQL.  We had a similar issue with auto-complete which was addressed in scoped_search 2.3.4; however, looks like a similar issues exists on a search queries also.

Another example that will generate this type of error is:
  provider.name = "spacewalk"

generates the following error:

SQLite3::SQLException: ambiguous column name: name: SELECT DISTINCT "providers".id FROM "providers" LEFT OUTER JOIN "products" ON "products"."provider_id" = "providers"."id" WHERE "providers"."organization_id" = 1 AND "providers"."provider_type" = 'Custom' AND (("products"."name" = 'spacewalk')) ORDER BY name LIMIT 25

Comment 2 Amos Benari 2011-10-16 16:14:04 UTC
Problem seemed to be the order statement not the scoped_search.
fixed by commit #08385944d35e24d7f29dba4675cc5d7fbf606904

Comment 3 Brad Buckingham 2011-10-18 18:40:31 UTC
Unfortunately, I still see the same problem with the change committed.  Example scenario:

1. create a provider : spacewalk
2. create a product under that provider : spacewalk_product
3. perform a provider search using : 
   product.name  =  spacewalk_product 

generates the following exception: 

SQLite3::SQLException: ambiguous column name: name: SELECT DISTINCT "products".name FROM "products" INNER JOIN "providers" ON "providers"."id" = "products"."provider_id" WHERE "providers"."organization_id" = 1 AND (name LIKE 'spacewalk_product%') LIMIT 20 

rather than "(name LIKE 'spacewalk_product%')", the query should contain something like "('products'.name LIKE 'spacewalk_product%')"

Comment 4 Jeff Weiss 2011-10-24 14:23:00 UTC
Brad's repro scenario still fails.  The original "plain" search term now works though.

katello-0.1.95-1.git.56.344ea38.el6.x86_64

Comment 5 Brad Buckingham 2011-11-14 21:05:24 UTC
verified that the issues raised in the initial description and my repro scenario are no longer observable with scoped_search 2.3.6... that version of scoped_search gem has been pushed in to the git repos and should be available in an upcoming build.

Comment 6 Jeff Weiss 2011-11-29 15:13:36 UTC
Verified, katello-0.1.116-1.git.0.ed4d8a9.el6.x86_64

Comment 10 Mike McCune 2013-08-16 17:53:05 UTC
getting rid of 6.0.0 version since that doesn't exist

Comment 11 Gilbert 2023-01-10 08:21:58 UTC Comment hidden (spam)