-- bad parameters should get through planning, but not execution:
EXPLAIN (COSTS OFF)
SELECT id FROM test_tablesample TABLESAMPLE system_time (-1);
- QUERY PLAN
---------------------------------------------------
- Sample Scan on test_tablesample
- Sampling: system_time ('-1'::double precision)
-(2 rows)
+ QUERY PLAN
+--------------------------------------------------------
+ Remote Fast Query Execution
+ Node/s: datanode_1, datanode_2
+ -> Sample Scan on test_tablesample
+ Sampling: system_time ('-1'::double precision)
+(4 rows)
SELECT id FROM test_tablesample TABLESAMPLE system_time (-1);
ERROR: sample collection time must not be negative
(VALUES (0),(100000)) v(time),
LATERAL (SELECT COUNT(*) FROM test_tablesample
TABLESAMPLE system_time (100000)) ss;
- QUERY PLAN
-------------------------------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------------------------------
Nested Loop
-> Aggregate
- -> Materialize
- -> Sample Scan on test_tablesample
- Sampling: system_time ('100000'::double precision)
+ -> Remote Subquery Scan on all (datanode_1,datanode_2)
+ -> Aggregate
+ -> Materialize
+ -> Sample Scan on test_tablesample
+ Sampling: system_time ('100000'::double precision)
-> Values Scan on "*VALUES*"
-(6 rows)
+(8 rows)
SELECT * FROM
(VALUES (0),(100000)) v(time),
(VALUES (0),(100000)) v(time),
LATERAL (SELECT COUNT(*) FROM test_tablesample
TABLESAMPLE system_time (time)) ss;
- QUERY PLAN
-----------------------------------------------------------------
+ QUERY PLAN
+----------------------------------------------------------------------------
Nested Loop
-> Values Scan on "*VALUES*"
-> Aggregate
- -> Materialize
- -> Sample Scan on test_tablesample
- Sampling: system_time ("*VALUES*".column1)
-(6 rows)
-
-SELECT * FROM
- (VALUES (0),(100000)) v(time),
- LATERAL (SELECT COUNT(*) FROM test_tablesample
- TABLESAMPLE system_time (time)) ss;
- time | count
---------+-------
- 0 | 0
- 100000 | 31
-(2 rows)
+ -> Remote Subquery Scan on all (datanode_1,datanode_2)
+ -> Aggregate
+ -> Materialize
+ -> Sample Scan on test_tablesample
+ Sampling: system_time ("*VALUES*".column1)
+(8 rows)
CREATE VIEW vv AS
SELECT * FROM test_tablesample TABLESAMPLE system_time (20);
EXPLAIN (COSTS OFF) SELECT * FROM vv;
- QUERY PLAN
---------------------------------------------------
- Sample Scan on test_tablesample
- Sampling: system_time ('20'::double precision)
-(2 rows)
+ QUERY PLAN
+--------------------------------------------------------
+ Remote Subquery Scan on all (datanode_1,datanode_2)
+ -> Sample Scan on test_tablesample
+ Sampling: system_time ('20'::double precision)
+(3 rows)
DROP EXTENSION tsm_system_time; -- fail, view depends on extension
ERROR: cannot drop extension tsm_system_time because other objects depend on it
DETAIL: view vv depends on function system_time(internal)
HINT: Use DROP ... CASCADE to drop the dependent objects too.
+DROP VIEW vv;
+DROP TABLE test_tablesample;
+DROP EXTENSION tsm_system_time;
--- /dev/null
+CREATE EXTENSION tsm_system_time;
+CREATE TABLE test_tablesample (id int, name text);
+INSERT INTO test_tablesample SELECT i, repeat(i::text, 1000)
+ FROM generate_series(0, 30) s(i);
+EXPLAIN (COSTS OFF)
+SELECT * FROM
+ (VALUES (0),(100000)) v(time),
+ LATERAL (SELECT COUNT(*) FROM test_tablesample
+ TABLESAMPLE system_time (time)) ss;
+ QUERY PLAN
+----------------------------------------------------------------------------
+ Nested Loop
+ -> Values Scan on "*VALUES*"
+ -> Aggregate
+ -> Remote Subquery Scan on all (datanode_1,datanode_2)
+ -> Aggregate
+ -> Materialize
+ -> Sample Scan on test_tablesample
+ Sampling: system_time ("*VALUES*".column1)
+(8 rows)
+
+SELECT * FROM
+ (VALUES (0),(100000)) v(time),
+ LATERAL (SELECT COUNT(*) FROM test_tablesample
+ TABLESAMPLE system_time (time)) ss;
+ time | count
+--------+-------
+ 0 | 0
+ 100000 | 31
+(2 rows)
+
+DROP TABLE test_tablesample;
+DROP EXTENSION tsm_system_time; -- fail, view depends on extension
--- /dev/null
+CREATE EXTENSION tsm_system_time;
+CREATE TABLE test_tablesample (id int, name text);
+INSERT INTO test_tablesample SELECT i, repeat(i::text, 1000)
+ FROM generate_series(0, 30) s(i);
+
+EXPLAIN (COSTS OFF)
+SELECT * FROM
+ (VALUES (0),(100000)) v(time),
+ LATERAL (SELECT COUNT(*) FROM test_tablesample
+ TABLESAMPLE system_time (time)) ss;
+
+SELECT * FROM
+ (VALUES (0),(100000)) v(time),
+ LATERAL (SELECT COUNT(*) FROM test_tablesample
+ TABLESAMPLE system_time (time)) ss;
+
+DROP TABLE test_tablesample;
+DROP EXTENSION tsm_system_time; -- fail, view depends on extension