ismop / dap

3 stars 0 forks source link

500 error triggered when measurement query finds no qualified measurements #105

Open nowakowski opened 8 years ago

nowakowski commented 8 years ago

D, [2016-05-11T09:45:42.627087 #7826] DEBUG -- : SQL (4.2ms) SELECT COUNT(m.) FROM (SELECT m., row_number() OVER(ORDER BY m.timeline_id, m.m_timestamp ASC) AS row FROM measurements m JOIN timelines t ON m.timeline_id = t.id WHERE m.m_timestamp BETWEEN '2016-04-27 07:45:36 UTC' AND '2016-05-11 07:45:36 UTC' AND m.timeline_id IN (9029,9028) ORDER BY m.timeline_id, m.m_timestamp ASC ) m D, [2016-05-11T09:45:42.631187 #7826] DEBUG -- : SQL (3.9ms) SELECT COUNT(DISTINCT m.timelineid) FROM (SELECT m., row_number() OVER(ORDER BY m.timeline_id, m.m_timestamp ASC) AS row FROM measurements m JOIN timelines t ON m.timeline_id = t.id WHERE m.m_timestamp BETWEEN '2016-04-27 07:45:36 UTC' AND '2016-05-11 07:45:36 UTC' AND m.timeline_id IN (9029,9028) ORDER BY m.timeline_id, m.mtimestamp ASC ) m D, [2016-05-11T09:45:42.632181 #7826] DEBUG -- : Measurement Load (0.7ms) SELECT m. FROM (SELECT m._, row_number() OVER(ORDER BY m.timeline_id, m.m_timestamp ASC) AS row FROM measurements m JOIN timelines t ON m.timeline_id = t.id WHERE m.m_timestamp BETWEEN '2016-04-27 07:45:36 UTC' AND '2016-05-11 07:45:36 UTC' AND m.timeline_id IN (9029,9028) ORDER BY m.timeline_id, m.m_timestamp ASC ) m WHERE m.row % 1 = 0 OR m.id IN () E, [2016-05-11T09:45:42.632277 #7826] ERROR -- : PG::SyntaxError: ERROR: syntax error at or near ")" LINE 1: ...d, m.mtimestamp ASC ) m WHERE m.row % 1 = 0 OR m.id IN () ^ : SELECT m. FROM (SELECT m._, row_number() OVER(ORDER BY m.timeline_id, m.m_timestamp ASC) AS row FROM measurements m JOIN timelines t ON m.timeline_id = t.id WHERE m.m_timestamp BETWEEN '2016-04-27 07:45:36 UTC' AND '2016-05-11 07:45:36 UTC' AND m.timeline_id IN (9029,9028) ORDER BY m.timeline_id, m.mtimestamp ASC ) m WHERE m.row % 1 = 0 OR m.id IN () I, [2016-05-11T09:45:42.632625 #7826] INFO -- : Completed 500 Internal Server Error in 34ms D, [2016-05-11T09:45:42.663712 #7826] DEBUG -- : * [Raven] Sending event d1b76e4e6caa968ba47cfdb61346995e to Sentry F, [2016-05-11T09:45:43.123691 #7826] FATAL -- : ActiveRecord::StatementInvalid (PG::SyntaxError: ERROR: syntax error at or near ")" LINE 1: ...d, m.m_timestamp ASC ) m WHERE m.row % 1 = 0 OR m.id IN () ^ : SELECT m.* FROM (SELECT m.*, row_number() OVER(ORDER BY m.timeline_id, m.m_timestamp ASC) AS row FROM measurements m JOIN timelines t ON m.timeline_id = t.id WHERE m.m_timestamp BETWEEN '2016-04-27 07:45:36 UTC' AND '2016-05-11 07:45:36 UTC' AND m.timeline_id IN (9029,9028) ORDER BY m.timeline_id, m.m_timestamp ASC ) m WHERE m.row % 1 = 0 OR m.id IN () ): app/controllers/api/v1/measurements_controller.rb:166:in `index'