| From: | PG Bug reporting form <noreply(at)postgresql(dot)org> | 
|---|---|
| To: | pgsql-bugs(at)lists(dot)postgresql(dot)org | 
| Cc: | anjithapaul(at)gmail(dot)com | 
| Subject: | BUG #16753: 'expected 2-element int8 array' error while getting data using query with subquery | 
| Date: | 2020-11-30 18:17:59 | 
| Message-ID: | 16753-0e156a5fd6cee2d3@postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
The following bug has been logged on the website:
Bug reference:      16753
Logged by:          Anjitha Paulose
Email address:      anjithapaul(at)gmail(dot)com
PostgreSQL version: 12.5
Operating system:   Windows, Linux
Description:        
I am using timescale db on top of postgres db. 
I am having table with mac_address and uptime. Mac address will be given
with colon or without colon. I am having the following data
   mac_address   |      timestamp      | uptime
-------------------+-----------------------------+----------
 AA:BB:45:TT:CC:34 | 2020-11-30 00:00:04 |    0
 112233445566         | 2020-11-30 00:00:06 |    0
 NN:CC:33:33:22:22 | 2020-11-30 00:00:05 |    0
 AA:BB:45:TT:CC:34 | 2020-11-30 00:30:04 |    1
 112233445566         | 2020-11-30 00:30:06 |    1
 NN:CC:33:33:22:22 | 2020-11-30 00:30:05 |    1 
I have created an hourly continous agggregate view to get average uptime in
each hour using below query
CREATE VIEW aggregated_data
WITH (timescaledb.continuous) AS
SELECT
time_bucket(INTERVAL '1 hour', timestamp) AS time_bucket,
mac_address,
AVG(uptime) AS avg_uptime
FROM data_table
GROUP BY time_bucket, mac_address
When I am trying to get data from aggregated_data table using below query, I
am getting error 'expected 2-element int8 array'
SELECT mac_address, time_bucket,
avg_uptime, count(*) over() as count
FROM aggregated_data
WHERE time_bucket >= '2020-10-28 18:00:00' and time_bucket < '2020-11-30
08:31:52'
AND mac_address IN (
          SELECT mac_address
          FROM aggregated_data
          WHERE time_bucket >= '2020-11-28 18:00:00' and time_bucket <
'2020-11-30 08:31:52'
          GROUP BY mac_address
          HAVING AVG(avg_uptime) > 0 AND AVG(avg_uptime) <=10
  )
ORDER BY time_bucket LIMIT 10 OFFSET 0
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2020-11-30 20:29:03 | Re: BUG #16753: 'expected 2-element int8 array' error while getting data using query with subquery | 
| Previous Message | David G. Johnston | 2020-11-30 15:32:35 | Re: Update on |