Bug #8326
closedsome errata queries result in ise 500
Description
Some errata searches such as:
package_name = foo
errata_id = foo
result in an ise 500
: "PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list↵LINE 1: ..._erratum_packages"."name" = 'kernel' ))) ORDER BY issued DES...↵ ^↵: SELECT DISTINCT "katello_errata"."id" AS t0_r0, "katello_errata"."uuid" AS t0_r1, "katello_errata"."errata_id" AS t0_r2, "katello_errata"."created_at" AS t0_r3, "katello_errata"."updated_at" AS t0_r4, "katello_errata"."issued" AS t0_r5, "katello_errata"."updated" AS t0_r6, "katello_errata"."errata_type" AS t0_r7, "katello_errata"."severity" AS t0_r8, "katello_errata"."title" AS t0_r9, "katello_errata"."solution" AS t0_r10, "katello_errata"."description" AS t0_r11, "katello_errata"."summary" AS t0_r12, "katello_errata"."reboot_suggested" AS t0_r13, "katello_erratum_packages"."id" AS t1_r0, "katello_erratum_packages"."erratum_id" AS t1_r1, "katello_erratum_packages"."nvrea" AS t1_r2, "katello_erratum_packages"."name" AS t1_r3, "katello_erratum_packages"."filename" AS t1_r4 FROM "katello_errata" INNER JOIN "katello_repository_errata" ON "katello_repository_errata"."erratum_id" = "katello_errata"."id" LEFT OUTER JOIN "katello_erratum_packages" ON "katello_erratum_packages"."erratum_id" = "katello_errata"."id" WHERE "katello_repository_errata"."repository_id" IN (SELECT "katello_repositories"."id" FROM "katello_repositories" WHERE "katello_repositories"."product_id" IN (SELECT "katello_products"."id" FROM "katello_products" ) AND "katello_repositories"."environment_id" IN (3, 5, 2, 1, 4) ORDER BY katello_repositories.name ASC) AND "katello_errata"."id" IN (2461, 2423, 2417, 2391, 2355, 2323, 2287, 2256, 2236, 2203, 2006, 1962, 1918, 1872, 1840, 1823, 1790, 1767, 1758, 1522) AND (("katello_errata"."id" IN (SELECT "erratum_id" FROM "katello_erratum_packages" WHERE "katello_erratum_packages"."name" = 'kernel' ))) ORDER BY issued DESC"