mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 11:03:36 +08:00
Improve interpolate error message on datatype mismatch
Include information about the expected and the returned datatype in the error details of interpolate.
This commit is contained in:
parent
a3d778f7a0
commit
90e54def8a
@ -38,6 +38,7 @@ accidentally triggering the load of a previous DB version.**
|
|||||||
* #5556 Fix duplicated entries on timescaledb_experimental.policies view
|
* #5556 Fix duplicated entries on timescaledb_experimental.policies view
|
||||||
* #5433 Fix join rte in CAggs with joins
|
* #5433 Fix join rte in CAggs with joins
|
||||||
* #5543 Copy scheduled_jobs list before sorting it
|
* #5543 Copy scheduled_jobs list before sorting it
|
||||||
|
* #5570 Improve interpolate error message on datatype mismatch
|
||||||
|
|
||||||
**Thanks**
|
**Thanks**
|
||||||
* @nikolaps for reporting an issue with the COPY fetcher
|
* @nikolaps for reporting an issue with the COPY fetcher
|
||||||
@ -47,6 +48,7 @@ accidentally triggering the load of a previous DB version.**
|
|||||||
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
|
* @H25E for reporting error refreshing from beginning of a Continuous Aggregate with variable time bucket
|
||||||
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
|
* @mwahlhuetter for reporting issue with duplicated entries on timescaledb_experimental.policies view
|
||||||
* @mwahlthuetter for reporting the issue with joins in CAggs
|
* @mwahlthuetter for reporting the issue with joins in CAggs
|
||||||
|
* @ollz272 for reporting an issue with interpolate error messages
|
||||||
|
|
||||||
## 2.10.1 (2023-03-07)
|
## 2.10.1 (2023-03-07)
|
||||||
|
|
||||||
|
@ -123,14 +123,20 @@ gapfill_fetch_sample(GapFillState *state, GapFillInterpolateColumnState *column,
|
|||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
errmsg("first argument of interpolate returned record must match used timestamp "
|
errmsg("first argument of interpolate returned record must match used timestamp "
|
||||||
"datatype")));
|
"datatype"),
|
||||||
|
errdetail("Returned type %s does not match expected type %s.",
|
||||||
|
format_type_be(TupleDescAttr(tupdesc, 0)->atttypid),
|
||||||
|
format_type_be(column->base.typid))));
|
||||||
|
|
||||||
/* check second element in record matches interpolate datatype */
|
/* check second element in record matches interpolate datatype */
|
||||||
if (TupleDescAttr(tupdesc, 1)->atttypid != column->base.typid)
|
if (TupleDescAttr(tupdesc, 1)->atttypid != column->base.typid)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
errmsg("second argument of interpolate returned record must match used "
|
errmsg("second argument of interpolate returned record must match used "
|
||||||
"interpolate datatype")));
|
"interpolate datatype"),
|
||||||
|
errdetail("Returned type %s does not match expected type %s.",
|
||||||
|
format_type_be(TupleDescAttr(tupdesc, 1)->atttypid),
|
||||||
|
format_type_be(column->base.typid))));
|
||||||
|
|
||||||
value = heap_getattr(&tuple, 1, tupdesc, &sample->isnull);
|
value = heap_getattr(&tuple, 1, tupdesc, &sample->isnull);
|
||||||
if (!sample->isnull)
|
if (!sample->isnull)
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Please see the included NOTICE for copyright information and
|
-- Please see the included NOTICE for copyright information and
|
||||||
-- LICENSE-TIMESCALE for a copy of the license.
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
||||||
|
-- we want to see error details in the output
|
||||||
|
\set VERBOSITY default
|
||||||
-- simple example
|
-- simple example
|
||||||
:EXPLAIN
|
:EXPLAIN
|
||||||
SELECT
|
SELECT
|
||||||
@ -324,6 +326,7 @@ FROM :METRICS
|
|||||||
WHERE time =0 AND time < 2
|
WHERE time =0 AND time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test with 2 tables and where clause doesnt match gapfill argument
|
-- test with 2 tables and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -331,6 +334,7 @@ FROM :METRICS m, :METRICS m2
|
|||||||
WHERE m.time >=0 AND m.time < 2
|
WHERE m.time >=0 AND m.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test inner join and where clause doesnt match gapfill argument
|
-- test inner join and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -338,6 +342,7 @@ FROM :METRICS m1 INNER JOIN :METRICS m2 ON m1.time=m2.time
|
|||||||
WHERE m1.time >=0 AND m1.time < 2
|
WHERE m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test outer join with constraints in join condition
|
-- test outer join with constraints in join condition
|
||||||
-- not usable as start/stop
|
-- not usable as start/stop
|
||||||
SELECT
|
SELECT
|
||||||
@ -345,6 +350,7 @@ SELECT
|
|||||||
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
\ir include/gapfill_metrics_query.sql
|
\ir include/gapfill_metrics_query.sql
|
||||||
-- This file and its contents are licensed under the Timescale License.
|
-- This file and its contents are licensed under the Timescale License.
|
||||||
@ -931,7 +937,10 @@ SELECT
|
|||||||
locf(min(time),treat_null_as_missing:=1)
|
locf(min(time),treat_null_as_missing:=1)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist at character 46
|
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist
|
||||||
|
LINE 3: locf(min(time),treat_null_as_missing:=1)
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test locf with treat_null_as_missing not literal
|
-- test locf with treat_null_as_missing not literal
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -972,12 +981,14 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate lookup query with mismatching value datatype
|
-- test interpolate lookup query with mismatching value datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -985,25 +996,33 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate with unsupported datatype
|
-- test interpolate with unsupported datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(text 'text')
|
interpolate(text 'text')
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(text) does not exist at character 46
|
ERROR: function interpolate(text) does not exist
|
||||||
|
LINE 3: interpolate(text 'text')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(interval '1d')
|
interpolate(interval '1d')
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(interval) does not exist at character 46
|
ERROR: function interpolate(interval) does not exist
|
||||||
|
LINE 3: interpolate(interval '1d')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test multiple time_bucket_gapfill calls
|
-- test multiple time_bucket_gapfill calls
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
||||||
@ -1051,7 +1070,9 @@ SELECT
|
|||||||
avg(avg(min(time)) OVER ()) OVER ()
|
avg(avg(min(time)) OVER ()) OVER ()
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: window function calls cannot be nested at character 50
|
ERROR: window function calls cannot be nested
|
||||||
|
LINE 3: avg(avg(min(time)) OVER ()) OVER ()
|
||||||
|
^
|
||||||
-- test multiple window functions in single column
|
-- test multiple window functions in single column
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -1089,11 +1110,13 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,NULL)
|
time_bucket_gapfill(1,time,1,NULL)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
||||||
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
||||||
@ -2371,6 +2394,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start/finish and no usable time constraints
|
-- NULL start/finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,NULL,NULL)
|
time_bucket_gapfill(1,t,NULL,NULL)
|
||||||
@ -2378,6 +2402,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- no start and no usable time constraints
|
-- no start and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,finish:=1)
|
time_bucket_gapfill(1,t,finish:=1)
|
||||||
@ -2385,6 +2410,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start expression and no usable time constraints
|
-- NULL start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
||||||
@ -2392,6 +2418,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported start expression and no usable time constraints
|
-- unsupported start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,t,1)
|
time_bucket_gapfill(1,t,t,1)
|
||||||
@ -2406,6 +2433,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish expression and no usable time constraints
|
-- NULL finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2413,6 +2441,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported finish expression and no usable time constraints
|
-- unsupported finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,t)
|
time_bucket_gapfill(1,t,1,t)
|
||||||
@ -2427,6 +2456,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish and no usable time constraints
|
-- NULL finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,NULL)
|
time_bucket_gapfill(1,t,1,NULL)
|
||||||
@ -2434,6 +2464,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with column reference on right side
|
-- expression with column reference on right side
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t)
|
time_bucket_gapfill(1,t)
|
||||||
@ -2441,6 +2472,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE t > t AND t < 2
|
WHERE t > t AND t < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with cast
|
-- expression with cast
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1::int8)
|
time_bucket_gapfill(1,t1::int8)
|
||||||
@ -2448,6 +2480,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 >= 1 AND t1 <= 2
|
WHERE t1 >= 1 AND t1 <= 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with multiple column references
|
-- expression with multiple column references
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1+t2)
|
time_bucket_gapfill(1,t1+t2)
|
||||||
@ -2455,6 +2488,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 1 AND t1 < 2
|
WHERE t1 > 1 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2462,6 +2496,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2469,6 +2504,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2476,6 +2512,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2483,6 +2520,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- time_bucket_gapfill with constraints ORed
|
-- time_bucket_gapfill with constraints ORed
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1::int8,t::int8)
|
time_bucket_gapfill(1::int8,t::int8)
|
||||||
@ -2491,6 +2529,7 @@ WHERE
|
|||||||
t >= -1 OR t < 3
|
t >= -1 OR t < 3
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
-- int32 time_bucket_gapfill with no start/finish
|
-- int32 time_bucket_gapfill with no start/finish
|
||||||
SELECT
|
SELECT
|
||||||
@ -3277,3 +3316,4 @@ SELECT time_bucket_gapfill('2 month'::interval, ts, 'Europe/Berlin', '2000-01-01
|
|||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
RESET timezone;
|
RESET timezone;
|
||||||
|
DROP INDEX gapfill_plan_test_indx;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Please see the included NOTICE for copyright information and
|
-- Please see the included NOTICE for copyright information and
|
||||||
-- LICENSE-TIMESCALE for a copy of the license.
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
||||||
|
-- we want to see error details in the output
|
||||||
|
\set VERBOSITY default
|
||||||
-- simple example
|
-- simple example
|
||||||
:EXPLAIN
|
:EXPLAIN
|
||||||
SELECT
|
SELECT
|
||||||
@ -331,6 +333,7 @@ FROM :METRICS
|
|||||||
WHERE time =0 AND time < 2
|
WHERE time =0 AND time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test with 2 tables and where clause doesnt match gapfill argument
|
-- test with 2 tables and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -338,6 +341,7 @@ FROM :METRICS m, :METRICS m2
|
|||||||
WHERE m.time >=0 AND m.time < 2
|
WHERE m.time >=0 AND m.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test inner join and where clause doesnt match gapfill argument
|
-- test inner join and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -345,6 +349,7 @@ FROM :METRICS m1 INNER JOIN :METRICS m2 ON m1.time=m2.time
|
|||||||
WHERE m1.time >=0 AND m1.time < 2
|
WHERE m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test outer join with constraints in join condition
|
-- test outer join with constraints in join condition
|
||||||
-- not usable as start/stop
|
-- not usable as start/stop
|
||||||
SELECT
|
SELECT
|
||||||
@ -352,6 +357,7 @@ SELECT
|
|||||||
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
\ir include/gapfill_metrics_query.sql
|
\ir include/gapfill_metrics_query.sql
|
||||||
-- This file and its contents are licensed under the Timescale License.
|
-- This file and its contents are licensed under the Timescale License.
|
||||||
@ -938,7 +944,10 @@ SELECT
|
|||||||
locf(min(time),treat_null_as_missing:=1)
|
locf(min(time),treat_null_as_missing:=1)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist at character 46
|
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist
|
||||||
|
LINE 3: locf(min(time),treat_null_as_missing:=1)
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test locf with treat_null_as_missing not literal
|
-- test locf with treat_null_as_missing not literal
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -979,12 +988,14 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate lookup query with mismatching value datatype
|
-- test interpolate lookup query with mismatching value datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -992,25 +1003,33 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate with unsupported datatype
|
-- test interpolate with unsupported datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(text 'text')
|
interpolate(text 'text')
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(text) does not exist at character 46
|
ERROR: function interpolate(text) does not exist
|
||||||
|
LINE 3: interpolate(text 'text')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(interval '1d')
|
interpolate(interval '1d')
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(interval) does not exist at character 46
|
ERROR: function interpolate(interval) does not exist
|
||||||
|
LINE 3: interpolate(interval '1d')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test multiple time_bucket_gapfill calls
|
-- test multiple time_bucket_gapfill calls
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
||||||
@ -1058,7 +1077,9 @@ SELECT
|
|||||||
avg(avg(min(time)) OVER ()) OVER ()
|
avg(avg(min(time)) OVER ()) OVER ()
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: window function calls cannot be nested at character 50
|
ERROR: window function calls cannot be nested
|
||||||
|
LINE 3: avg(avg(min(time)) OVER ()) OVER ()
|
||||||
|
^
|
||||||
-- test multiple window functions in single column
|
-- test multiple window functions in single column
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -1096,11 +1117,13 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,NULL)
|
time_bucket_gapfill(1,time,1,NULL)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
||||||
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
||||||
@ -2378,6 +2401,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start/finish and no usable time constraints
|
-- NULL start/finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,NULL,NULL)
|
time_bucket_gapfill(1,t,NULL,NULL)
|
||||||
@ -2385,6 +2409,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- no start and no usable time constraints
|
-- no start and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,finish:=1)
|
time_bucket_gapfill(1,t,finish:=1)
|
||||||
@ -2392,6 +2417,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start expression and no usable time constraints
|
-- NULL start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
||||||
@ -2399,6 +2425,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported start expression and no usable time constraints
|
-- unsupported start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,t,1)
|
time_bucket_gapfill(1,t,t,1)
|
||||||
@ -2413,6 +2440,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish expression and no usable time constraints
|
-- NULL finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2420,6 +2448,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported finish expression and no usable time constraints
|
-- unsupported finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,t)
|
time_bucket_gapfill(1,t,1,t)
|
||||||
@ -2434,6 +2463,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish and no usable time constraints
|
-- NULL finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,NULL)
|
time_bucket_gapfill(1,t,1,NULL)
|
||||||
@ -2441,6 +2471,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with column reference on right side
|
-- expression with column reference on right side
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t)
|
time_bucket_gapfill(1,t)
|
||||||
@ -2448,6 +2479,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE t > t AND t < 2
|
WHERE t > t AND t < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with cast
|
-- expression with cast
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1::int8)
|
time_bucket_gapfill(1,t1::int8)
|
||||||
@ -2455,6 +2487,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 >= 1 AND t1 <= 2
|
WHERE t1 >= 1 AND t1 <= 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with multiple column references
|
-- expression with multiple column references
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1+t2)
|
time_bucket_gapfill(1,t1+t2)
|
||||||
@ -2462,6 +2495,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 1 AND t1 < 2
|
WHERE t1 > 1 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2469,6 +2503,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2476,6 +2511,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2483,6 +2519,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2490,6 +2527,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- time_bucket_gapfill with constraints ORed
|
-- time_bucket_gapfill with constraints ORed
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1::int8,t::int8)
|
time_bucket_gapfill(1::int8,t::int8)
|
||||||
@ -2498,6 +2536,7 @@ WHERE
|
|||||||
t >= -1 OR t < 3
|
t >= -1 OR t < 3
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
-- int32 time_bucket_gapfill with no start/finish
|
-- int32 time_bucket_gapfill with no start/finish
|
||||||
SELECT
|
SELECT
|
||||||
@ -3284,3 +3323,4 @@ SELECT time_bucket_gapfill('2 month'::interval, ts, 'Europe/Berlin', '2000-01-01
|
|||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
RESET timezone;
|
RESET timezone;
|
||||||
|
DROP INDEX gapfill_plan_test_indx;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Please see the included NOTICE for copyright information and
|
-- Please see the included NOTICE for copyright information and
|
||||||
-- LICENSE-TIMESCALE for a copy of the license.
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
||||||
|
-- we want to see error details in the output
|
||||||
|
\set VERBOSITY default
|
||||||
-- simple example
|
-- simple example
|
||||||
:EXPLAIN
|
:EXPLAIN
|
||||||
SELECT
|
SELECT
|
||||||
@ -331,6 +333,7 @@ FROM :METRICS
|
|||||||
WHERE time =0 AND time < 2
|
WHERE time =0 AND time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test with 2 tables and where clause doesnt match gapfill argument
|
-- test with 2 tables and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -338,6 +341,7 @@ FROM :METRICS m, :METRICS m2
|
|||||||
WHERE m.time >=0 AND m.time < 2
|
WHERE m.time >=0 AND m.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test inner join and where clause doesnt match gapfill argument
|
-- test inner join and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -345,6 +349,7 @@ FROM :METRICS m1 INNER JOIN :METRICS m2 ON m1.time=m2.time
|
|||||||
WHERE m1.time >=0 AND m1.time < 2
|
WHERE m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test outer join with constraints in join condition
|
-- test outer join with constraints in join condition
|
||||||
-- not usable as start/stop
|
-- not usable as start/stop
|
||||||
SELECT
|
SELECT
|
||||||
@ -352,6 +357,7 @@ SELECT
|
|||||||
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
\ir include/gapfill_metrics_query.sql
|
\ir include/gapfill_metrics_query.sql
|
||||||
-- This file and its contents are licensed under the Timescale License.
|
-- This file and its contents are licensed under the Timescale License.
|
||||||
@ -938,7 +944,10 @@ SELECT
|
|||||||
locf(min(time),treat_null_as_missing:=1)
|
locf(min(time),treat_null_as_missing:=1)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist at character 46
|
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist
|
||||||
|
LINE 3: locf(min(time),treat_null_as_missing:=1)
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test locf with treat_null_as_missing not literal
|
-- test locf with treat_null_as_missing not literal
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -979,12 +988,14 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate lookup query with mismatching value datatype
|
-- test interpolate lookup query with mismatching value datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -992,25 +1003,33 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate with unsupported datatype
|
-- test interpolate with unsupported datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(text 'text')
|
interpolate(text 'text')
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(text) does not exist at character 46
|
ERROR: function interpolate(text) does not exist
|
||||||
|
LINE 3: interpolate(text 'text')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(interval '1d')
|
interpolate(interval '1d')
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(interval) does not exist at character 46
|
ERROR: function interpolate(interval) does not exist
|
||||||
|
LINE 3: interpolate(interval '1d')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test multiple time_bucket_gapfill calls
|
-- test multiple time_bucket_gapfill calls
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
||||||
@ -1058,7 +1077,9 @@ SELECT
|
|||||||
avg(avg(min(time)) OVER ()) OVER ()
|
avg(avg(min(time)) OVER ()) OVER ()
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: window function calls cannot be nested at character 50
|
ERROR: window function calls cannot be nested
|
||||||
|
LINE 3: avg(avg(min(time)) OVER ()) OVER ()
|
||||||
|
^
|
||||||
-- test multiple window functions in single column
|
-- test multiple window functions in single column
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -1096,11 +1117,13 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,NULL)
|
time_bucket_gapfill(1,time,1,NULL)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
||||||
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
||||||
@ -2378,6 +2401,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start/finish and no usable time constraints
|
-- NULL start/finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,NULL,NULL)
|
time_bucket_gapfill(1,t,NULL,NULL)
|
||||||
@ -2385,6 +2409,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- no start and no usable time constraints
|
-- no start and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,finish:=1)
|
time_bucket_gapfill(1,t,finish:=1)
|
||||||
@ -2392,6 +2417,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start expression and no usable time constraints
|
-- NULL start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
||||||
@ -2399,6 +2425,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported start expression and no usable time constraints
|
-- unsupported start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,t,1)
|
time_bucket_gapfill(1,t,t,1)
|
||||||
@ -2413,6 +2440,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish expression and no usable time constraints
|
-- NULL finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2420,6 +2448,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported finish expression and no usable time constraints
|
-- unsupported finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,t)
|
time_bucket_gapfill(1,t,1,t)
|
||||||
@ -2434,6 +2463,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish and no usable time constraints
|
-- NULL finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,NULL)
|
time_bucket_gapfill(1,t,1,NULL)
|
||||||
@ -2441,6 +2471,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with column reference on right side
|
-- expression with column reference on right side
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t)
|
time_bucket_gapfill(1,t)
|
||||||
@ -2448,6 +2479,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE t > t AND t < 2
|
WHERE t > t AND t < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with cast
|
-- expression with cast
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1::int8)
|
time_bucket_gapfill(1,t1::int8)
|
||||||
@ -2455,6 +2487,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 >= 1 AND t1 <= 2
|
WHERE t1 >= 1 AND t1 <= 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with multiple column references
|
-- expression with multiple column references
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1+t2)
|
time_bucket_gapfill(1,t1+t2)
|
||||||
@ -2462,6 +2495,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 1 AND t1 < 2
|
WHERE t1 > 1 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2469,6 +2503,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2476,6 +2511,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2483,6 +2519,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2490,6 +2527,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- time_bucket_gapfill with constraints ORed
|
-- time_bucket_gapfill with constraints ORed
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1::int8,t::int8)
|
time_bucket_gapfill(1::int8,t::int8)
|
||||||
@ -2498,6 +2536,7 @@ WHERE
|
|||||||
t >= -1 OR t < 3
|
t >= -1 OR t < 3
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
-- int32 time_bucket_gapfill with no start/finish
|
-- int32 time_bucket_gapfill with no start/finish
|
||||||
SELECT
|
SELECT
|
||||||
@ -3284,3 +3323,4 @@ SELECT time_bucket_gapfill('2 month'::interval, ts, 'Europe/Berlin', '2000-01-01
|
|||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
RESET timezone;
|
RESET timezone;
|
||||||
|
DROP INDEX gapfill_plan_test_indx;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Please see the included NOTICE for copyright information and
|
-- Please see the included NOTICE for copyright information and
|
||||||
-- LICENSE-TIMESCALE for a copy of the license.
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
||||||
|
-- we want to see error details in the output
|
||||||
|
\set VERBOSITY default
|
||||||
-- simple example
|
-- simple example
|
||||||
:EXPLAIN
|
:EXPLAIN
|
||||||
SELECT
|
SELECT
|
||||||
@ -331,6 +333,7 @@ FROM :METRICS
|
|||||||
WHERE time =0 AND time < 2
|
WHERE time =0 AND time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test with 2 tables and where clause doesnt match gapfill argument
|
-- test with 2 tables and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -338,6 +341,7 @@ FROM :METRICS m, :METRICS m2
|
|||||||
WHERE m.time >=0 AND m.time < 2
|
WHERE m.time >=0 AND m.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test inner join and where clause doesnt match gapfill argument
|
-- test inner join and where clause doesnt match gapfill argument
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,m2.time)
|
time_bucket_gapfill(1,m2.time)
|
||||||
@ -345,6 +349,7 @@ FROM :METRICS m1 INNER JOIN :METRICS m2 ON m1.time=m2.time
|
|||||||
WHERE m1.time >=0 AND m1.time < 2
|
WHERE m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- test outer join with constraints in join condition
|
-- test outer join with constraints in join condition
|
||||||
-- not usable as start/stop
|
-- not usable as start/stop
|
||||||
SELECT
|
SELECT
|
||||||
@ -352,6 +357,7 @@ SELECT
|
|||||||
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
FROM :METRICS m1 LEFT OUTER JOIN :METRICS m2 ON m1.time=m2.time AND m1.time >=0 AND m1.time < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
\ir include/gapfill_metrics_query.sql
|
\ir include/gapfill_metrics_query.sql
|
||||||
-- This file and its contents are licensed under the Timescale License.
|
-- This file and its contents are licensed under the Timescale License.
|
||||||
@ -938,7 +944,10 @@ SELECT
|
|||||||
locf(min(time),treat_null_as_missing:=1)
|
locf(min(time),treat_null_as_missing:=1)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist at character 46
|
ERROR: function locf(integer, treat_null_as_missing => integer) does not exist
|
||||||
|
LINE 3: locf(min(time),treat_null_as_missing:=1)
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test locf with treat_null_as_missing not literal
|
-- test locf with treat_null_as_missing not literal
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -979,12 +988,14 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
interpolate(min(time),prev=>(SELECT (10::float,10)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
ERROR: first argument of interpolate returned record must match used timestamp datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate lookup query with mismatching value datatype
|
-- test interpolate lookup query with mismatching value datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -992,25 +1003,33 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
interpolate(min(time),prev=>(SELECT (10,10::float)))
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
ERROR: second argument of interpolate returned record must match used interpolate datatype
|
||||||
|
DETAIL: Returned type double precision does not match expected type integer.
|
||||||
-- test interpolate with unsupported datatype
|
-- test interpolate with unsupported datatype
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(text 'text')
|
interpolate(text 'text')
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(text) does not exist at character 46
|
ERROR: function interpolate(text) does not exist
|
||||||
|
LINE 3: interpolate(text 'text')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
interpolate(interval '1d')
|
interpolate(interval '1d')
|
||||||
FROM (VALUES (2),(3)) v(time)
|
FROM (VALUES (2),(3)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: function interpolate(interval) does not exist at character 46
|
ERROR: function interpolate(interval) does not exist
|
||||||
|
LINE 3: interpolate(interval '1d')
|
||||||
|
^
|
||||||
|
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
|
||||||
-- test multiple time_bucket_gapfill calls
|
-- test multiple time_bucket_gapfill calls
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
time_bucket_gapfill(1,time,1,11),time_bucket_gapfill(1,time,1,11)
|
||||||
@ -1058,7 +1077,9 @@ SELECT
|
|||||||
avg(avg(min(time)) OVER ()) OVER ()
|
avg(avg(min(time)) OVER ()) OVER ()
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: window function calls cannot be nested at character 50
|
ERROR: window function calls cannot be nested
|
||||||
|
LINE 3: avg(avg(min(time)) OVER ()) OVER ()
|
||||||
|
^
|
||||||
-- test multiple window functions in single column
|
-- test multiple window functions in single column
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,11),
|
time_bucket_gapfill(1,time,1,11),
|
||||||
@ -1096,11 +1117,13 @@ SELECT
|
|||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,time,1,NULL)
|
time_bucket_gapfill(1,time,1,NULL)
|
||||||
FROM (VALUES (1),(2)) v(time)
|
FROM (VALUES (1),(2)) v(time)
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
time_bucket_gapfill(NULL,time,'Europe/Berlin','2000-06-01','2001-06-01')
|
||||||
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
FROM (VALUES ('2000-01-01'::timestamptz),('2001-01-01'::timestamptz)) v(time)
|
||||||
@ -2378,6 +2401,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start/finish and no usable time constraints
|
-- NULL start/finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,NULL,NULL)
|
time_bucket_gapfill(1,t,NULL,NULL)
|
||||||
@ -2385,6 +2409,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- no start and no usable time constraints
|
-- no start and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,finish:=1)
|
time_bucket_gapfill(1,t,finish:=1)
|
||||||
@ -2392,6 +2417,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL start expression and no usable time constraints
|
-- NULL start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
time_bucket_gapfill(1,t,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END,1)
|
||||||
@ -2399,6 +2425,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported start expression and no usable time constraints
|
-- unsupported start expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,t,1)
|
time_bucket_gapfill(1,t,t,1)
|
||||||
@ -2413,6 +2440,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish expression and no usable time constraints
|
-- NULL finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t,1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2420,6 +2448,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- unsupported finish expression and no usable time constraints
|
-- unsupported finish expression and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,t)
|
time_bucket_gapfill(1,t,1,t)
|
||||||
@ -2434,6 +2463,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- NULL finish and no usable time constraints
|
-- NULL finish and no usable time constraints
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t,1,NULL)
|
time_bucket_gapfill(1,t,1,NULL)
|
||||||
@ -2441,6 +2471,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE true AND true
|
WHERE true AND true
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer finish from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with column reference on right side
|
-- expression with column reference on right side
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t)
|
time_bucket_gapfill(1,t)
|
||||||
@ -2448,6 +2479,7 @@ FROM (VALUES (1),(2)) v(t)
|
|||||||
WHERE t > t AND t < 2
|
WHERE t > t AND t < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
ERROR: missing time_bucket_gapfill argument: could not infer start from WHERE clause
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with cast
|
-- expression with cast
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1::int8)
|
time_bucket_gapfill(1,t1::int8)
|
||||||
@ -2455,6 +2487,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 >= 1 AND t1 <= 2
|
WHERE t1 >= 1 AND t1 <= 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with multiple column references
|
-- expression with multiple column references
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1+t2)
|
time_bucket_gapfill(1,t1+t2)
|
||||||
@ -2462,6 +2495,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 1 AND t1 < 2
|
WHERE t1 > 1 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL start in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2469,6 +2503,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
WHERE t1 > CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END AND t1 < 4
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
-- expression with NULL finish in WHERE clause, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1)
|
time_bucket_gapfill(1,t1)
|
||||||
@ -2476,6 +2511,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
WHERE t1 > 0 AND t1 < CASE WHEN length(version()) > 0 THEN NULL::int ELSE NULL::int END
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as start argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2483,6 +2519,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: start cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
-- non-Const NULL as finish argument, we use CASE to wrap the NULL so it doesnt get folded
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
time_bucket_gapfill(1,t1,NULL,CASE WHEN length(version())>0 THEN NULL::int ELSE NULL::int END)
|
||||||
@ -2490,6 +2527,7 @@ FROM (VALUES (1,2),(2,2)) v(t1,t2)
|
|||||||
WHERE t1 > 0 AND t1 < 2
|
WHERE t1 > 0 AND t1 < 2
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
ERROR: invalid time_bucket_gapfill argument: finish cannot be NULL
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
-- time_bucket_gapfill with constraints ORed
|
-- time_bucket_gapfill with constraints ORed
|
||||||
SELECT
|
SELECT
|
||||||
time_bucket_gapfill(1::int8,t::int8)
|
time_bucket_gapfill(1::int8,t::int8)
|
||||||
@ -2498,6 +2536,7 @@ WHERE
|
|||||||
t >= -1 OR t < 3
|
t >= -1 OR t < 3
|
||||||
GROUP BY 1;
|
GROUP BY 1;
|
||||||
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
ERROR: invalid time_bucket_gapfill argument: ts needs to refer to a single column if no start or finish is supplied
|
||||||
|
HINT: Specify start and finish as arguments or in the WHERE clause.
|
||||||
\set ON_ERROR_STOP 1
|
\set ON_ERROR_STOP 1
|
||||||
-- int32 time_bucket_gapfill with no start/finish
|
-- int32 time_bucket_gapfill with no start/finish
|
||||||
SELECT
|
SELECT
|
||||||
@ -3284,3 +3323,4 @@ SELECT time_bucket_gapfill('2 month'::interval, ts, 'Europe/Berlin', '2000-01-01
|
|||||||
(6 rows)
|
(6 rows)
|
||||||
|
|
||||||
RESET timezone;
|
RESET timezone;
|
||||||
|
DROP INDEX gapfill_plan_test_indx;
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
-- LICENSE-TIMESCALE for a copy of the license.
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
|
|
||||||
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
\set EXPLAIN 'EXPLAIN (COSTS OFF)'
|
||||||
|
-- we want to see error details in the output
|
||||||
|
\set VERBOSITY default
|
||||||
|
|
||||||
-- simple example
|
-- simple example
|
||||||
:EXPLAIN
|
:EXPLAIN
|
||||||
@ -1502,3 +1504,5 @@ SET timezone TO 'Europe/Berlin';
|
|||||||
SELECT time_bucket_gapfill('2 month'::interval, ts, 'Europe/Berlin', '2000-01-01','2001-01-01') FROM (VALUES ('2000-03-01'::timestamptz)) v(ts) GROUP BY 1;
|
SELECT time_bucket_gapfill('2 month'::interval, ts, 'Europe/Berlin', '2000-01-01','2001-01-01') FROM (VALUES ('2000-03-01'::timestamptz)) v(ts) GROUP BY 1;
|
||||||
RESET timezone;
|
RESET timezone;
|
||||||
|
|
||||||
|
DROP INDEX gapfill_plan_test_indx;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user