From 74ec0da751fa06f3aa97f183161963f790a9aab3 Mon Sep 17 00:00:00 2001 From: Tim Wade Date: Tue, 16 May 2017 13:20:42 -0700 Subject: [PATCH] Ensure order is qualified by table name for rss feeds BEFORE: ``` SELECT "vms"."id" [...] ORDER BY created_on DESC ``` This is problematic because if we later join another table to this scope and execute the query, if that table has a `created_on` field Postgres will complain and throw an error for the ambiguous statement. AFTER: ``` SELECT "vms"."id" [...] ORDER BY "vms"."created_on" DESC ``` Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1451180 --- product/alerts/rss/all_alert_event.yml | 3 ++- product/alerts/rss/cluster_alert_event.yml | 3 ++- product/alerts/rss/dev_vms.yml | 3 ++- product/alerts/rss/evmevents.yml | 3 ++- product/alerts/rss/host_alert_event.yml | 3 ++- product/alerts/rss/lifecycle_events.yml | 3 ++- product/alerts/rss/microsoft_vms.yml | 3 ++- product/alerts/rss/newest_hosts.yml | 3 ++- product/alerts/rss/newest_vms.yml | 3 ++- product/alerts/rss/polevents_vmconfiguration.yml | 3 ++- product/alerts/rss/prod_hosts.yml | 3 ++- product/alerts/rss/prod_vms.yml | 3 ++- product/alerts/rss/test_vms.yml | 3 ++- product/alerts/rss/vm_alert_event.yml | 3 ++- product/alerts/rss/vmotionedvm.yml | 4 +++- product/alerts/rss/vmpowerevent.yml | 3 ++- product/alerts/rss/vmpoweroff.yml | 3 ++- product/alerts/rss/vmreconfigevent.yml | 4 +++- product/alerts/rss/vmware_vms.yml | 3 ++- 19 files changed, 40 insertions(+), 19 deletions(-) diff --git a/product/alerts/rss/all_alert_event.yml b/product/alerts/rss/all_alert_event.yml index 83f460e5f0a..b602f9755b7 100644 --- a/product/alerts/rss/all_alert_event.yml +++ b/product/alerts/rss/all_alert_event.yml @@ -34,7 +34,8 @@ search_method: search_conditions: "event_type = 'EVMAlertEvent'" limit_to_time: limit_to_count: -orderby: "timestamp DESC" +orderby: + :timestamp: :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/cluster_alert_event.yml b/product/alerts/rss/cluster_alert_event.yml index fe91c531887..528ef4af5b2 100644 --- a/product/alerts/rss/cluster_alert_event.yml +++ b/product/alerts/rss/cluster_alert_event.yml @@ -21,7 +21,8 @@ search_method: search_conditions: "event_type = 'EVMAlertEvent' AND target_type = 'EmsCluster'" limit_to_time: limit_to_count: -orderby: "timestamp DESC" +orderby: + :timestamp: :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/dev_vms.yml b/product/alerts/rss/dev_vms.yml index 6e7e4c2ed3c..75f28a0384d 100644 --- a/product/alerts/rss/dev_vms.yml +++ b/product/alerts/rss/dev_vms.yml @@ -29,7 +29,8 @@ item_class: Vm search_method: limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # Included tables and columns for query performance include: diff --git a/product/alerts/rss/evmevents.yml b/product/alerts/rss/evmevents.yml index 1104f7dde8b..22a2f98e876 100644 --- a/product/alerts/rss/evmevents.yml +++ b/product/alerts/rss/evmevents.yml @@ -28,7 +28,8 @@ search_method: search_conditions: "event_type = 'GeneralUserEvent' and message like '%EVM%'" limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/host_alert_event.yml b/product/alerts/rss/host_alert_event.yml index 9a5d075a3a4..03dd8441129 100644 --- a/product/alerts/rss/host_alert_event.yml +++ b/product/alerts/rss/host_alert_event.yml @@ -21,7 +21,8 @@ search_method: search_conditions: "event_type = 'EVMAlertEvent' AND target_type = 'Host'" limit_to_time: limit_to_count: -orderby: "timestamp DESC" +orderby: + :timestamp: :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/lifecycle_events.yml b/product/alerts/rss/lifecycle_events.yml index a6899a227b3..34b9eb138aa 100644 --- a/product/alerts/rss/lifecycle_events.yml +++ b/product/alerts/rss/lifecycle_events.yml @@ -25,7 +25,8 @@ item_class: LifecycleEvent search_method: limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # Included tables and columns for query performance include: diff --git a/product/alerts/rss/microsoft_vms.yml b/product/alerts/rss/microsoft_vms.yml index 6a989b45246..2e5906b70e2 100644 --- a/product/alerts/rss/microsoft_vms.yml +++ b/product/alerts/rss/microsoft_vms.yml @@ -30,7 +30,8 @@ search_method: search_conditions: "vendor = 'microsoft'" limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # Included tables and columns for query performance include: diff --git a/product/alerts/rss/newest_hosts.yml b/product/alerts/rss/newest_hosts.yml index 0395fc0d0a8..2b5cdd7af97 100644 --- a/product/alerts/rss/newest_hosts.yml +++ b/product/alerts/rss/newest_hosts.yml @@ -18,7 +18,8 @@ item_class: Host search_method: limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # tags_include: any or all tag_ns: "/managed/lifecycles" diff --git a/product/alerts/rss/newest_vms.yml b/product/alerts/rss/newest_vms.yml index 9ffd35f48df..ecf91714960 100644 --- a/product/alerts/rss/newest_vms.yml +++ b/product/alerts/rss/newest_vms.yml @@ -27,7 +27,8 @@ item_class: Vm search_method: limit_to_time: limit_to_count: -orderby: "vms.created_on DESC" +orderby: + :created_on: :desc # Included tables and columns for query performance include: diff --git a/product/alerts/rss/polevents_vmconfiguration.yml b/product/alerts/rss/polevents_vmconfiguration.yml index ac80f26f47b..82db85d1abc 100644 --- a/product/alerts/rss/polevents_vmconfiguration.yml +++ b/product/alerts/rss/polevents_vmconfiguration.yml @@ -29,7 +29,8 @@ search_method: search_conditions: "event_type = 'vm_create' OR event_type = 'vm_clone' OR event_type = 'vm_clone_start' OR event_type = 'vm_template' OR event_type = 'vm_reconfigure' OR event_type = 'request_vm_destroy'" limit_to_time: limit_to_count: -orderby: "timestamp DESC" +orderby: + :timestamp: :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/prod_hosts.yml b/product/alerts/rss/prod_hosts.yml index d911ddcb8bc..57d6dcc04a4 100644 --- a/product/alerts/rss/prod_hosts.yml +++ b/product/alerts/rss/prod_hosts.yml @@ -18,7 +18,8 @@ item_class: Host search_method: limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # tags_include: any or all tag_ns: "/managed/environment" diff --git a/product/alerts/rss/prod_vms.yml b/product/alerts/rss/prod_vms.yml index 0485e3c9a5f..73a17a11fb8 100644 --- a/product/alerts/rss/prod_vms.yml +++ b/product/alerts/rss/prod_vms.yml @@ -29,7 +29,8 @@ item_class: Vm search_method: limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # Included tables and columns for query performance include: diff --git a/product/alerts/rss/test_vms.yml b/product/alerts/rss/test_vms.yml index 22bfeacaad4..a9839c8eeaf 100644 --- a/product/alerts/rss/test_vms.yml +++ b/product/alerts/rss/test_vms.yml @@ -29,7 +29,8 @@ item_class: Vm search_method: limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # Included tables and columns for query performance include: diff --git a/product/alerts/rss/vm_alert_event.yml b/product/alerts/rss/vm_alert_event.yml index f2afbb24e85..6966fe787fc 100644 --- a/product/alerts/rss/vm_alert_event.yml +++ b/product/alerts/rss/vm_alert_event.yml @@ -21,7 +21,8 @@ search_method: search_conditions: "event_type = 'EVMAlertEvent' AND target_type = 'VmOrTemplate'" limit_to_time: limit_to_count: -orderby: "timestamp DESC" +orderby: + :timestamp: :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/vmotionedvm.yml b/product/alerts/rss/vmotionedvm.yml index ecfc204dc6f..2d1aa19d3f0 100644 --- a/product/alerts/rss/vmotionedvm.yml +++ b/product/alerts/rss/vmotionedvm.yml @@ -20,9 +20,11 @@ search_method: search_conditions: "event_type = 'RelocateVM_Task_Complete'" limit_to_time: limit_to_count: -orderby: "created_on DESC" # tags_include: any or all tag_ns: tags_include: tags: +orderby: + :created_on: :desc + diff --git a/product/alerts/rss/vmpowerevent.yml b/product/alerts/rss/vmpowerevent.yml index a46cdcf2346..151c7f0ae24 100644 --- a/product/alerts/rss/vmpowerevent.yml +++ b/product/alerts/rss/vmpowerevent.yml @@ -28,7 +28,8 @@ search_method: search_conditions: "event_type = 'VmPoweredOffEvent' OR event_type = 'VmPoweredOnEvent'" limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/vmpoweroff.yml b/product/alerts/rss/vmpoweroff.yml index a86dd6712af..9aa20efabfd 100644 --- a/product/alerts/rss/vmpoweroff.yml +++ b/product/alerts/rss/vmpoweroff.yml @@ -20,7 +20,8 @@ search_method: search_conditions: "event_type = 'VmPoweredOffEvent'" limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on :desc # tags_include: any or all tag_ns: diff --git a/product/alerts/rss/vmreconfigevent.yml b/product/alerts/rss/vmreconfigevent.yml index 0c7a6152e29..27979d90c4e 100644 --- a/product/alerts/rss/vmreconfigevent.yml +++ b/product/alerts/rss/vmreconfigevent.yml @@ -20,9 +20,11 @@ search_method: search_conditions: "event_type = 'ReconfigVM_Task_Complete'" limit_to_time: limit_to_count: -orderby: "created_on DESC" # tags_include: any or all tag_ns: tags_include: tags: +orderby: + :created_on: :desc + diff --git a/product/alerts/rss/vmware_vms.yml b/product/alerts/rss/vmware_vms.yml index 042ef33d886..0ea315245fd 100644 --- a/product/alerts/rss/vmware_vms.yml +++ b/product/alerts/rss/vmware_vms.yml @@ -28,7 +28,8 @@ search_method: search_conditions: "vendor = 'vmware'" limit_to_time: limit_to_count: -orderby: "created_on DESC" +orderby: + :created_on: :desc # Included tables and columns for query performance include: