mirror of https://github.com/citusdata/citus.git
Support intermediate results in distributed INSERT..SELECT
parent
90cdfff602
commit
f8cfe07fd1
|
@ -332,7 +332,7 @@ DistributedInsertSelectSupported(Query *queryTree, RangeTblEntry *insertRte,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contain_volatile_functions((Node *) queryTree))
|
if (FindNodeCheck((Node *) queryTree, CitusIsVolatileFunction))
|
||||||
{
|
{
|
||||||
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
|
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
|
||||||
"volatile functions are not allowed in distributed "
|
"volatile functions are not allowed in distributed "
|
||||||
|
|
|
@ -1775,6 +1775,25 @@ SELECT count(*) FROM raw_events_second;
|
||||||
38
|
38
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- intermediate results (CTEs) should be allowed when doing INSERT...SELECT within a CTE
|
||||||
|
WITH series AS (
|
||||||
|
SELECT s AS val FROM generate_series(60,70) s
|
||||||
|
),
|
||||||
|
inserts AS (
|
||||||
|
INSERT INTO raw_events_second (user_id)
|
||||||
|
SELECT
|
||||||
|
user_id
|
||||||
|
FROM
|
||||||
|
raw_events_first JOIN series ON (value_1 = val)
|
||||||
|
RETURNING
|
||||||
|
NULL
|
||||||
|
)
|
||||||
|
SELECT count(*) FROM inserts;
|
||||||
|
count
|
||||||
|
-------
|
||||||
|
2
|
||||||
|
(1 row)
|
||||||
|
|
||||||
-- we need this in our next test
|
-- we need this in our next test
|
||||||
truncate raw_events_first;
|
truncate raw_events_first;
|
||||||
SET client_min_messages TO DEBUG2;
|
SET client_min_messages TO DEBUG2;
|
||||||
|
|
|
@ -1420,6 +1420,21 @@ INSERT INTO raw_events_first (user_id, time, value_1, value_2, value_3, value_4)
|
||||||
INSERT INTO raw_events_second SELECT * FROM test_view WHERE user_id = 17 GROUP BY 1,2,3,4,5,6;
|
INSERT INTO raw_events_second SELECT * FROM test_view WHERE user_id = 17 GROUP BY 1,2,3,4,5,6;
|
||||||
SELECT count(*) FROM raw_events_second;
|
SELECT count(*) FROM raw_events_second;
|
||||||
|
|
||||||
|
-- intermediate results (CTEs) should be allowed when doing INSERT...SELECT within a CTE
|
||||||
|
WITH series AS (
|
||||||
|
SELECT s AS val FROM generate_series(60,70) s
|
||||||
|
),
|
||||||
|
inserts AS (
|
||||||
|
INSERT INTO raw_events_second (user_id)
|
||||||
|
SELECT
|
||||||
|
user_id
|
||||||
|
FROM
|
||||||
|
raw_events_first JOIN series ON (value_1 = val)
|
||||||
|
RETURNING
|
||||||
|
NULL
|
||||||
|
)
|
||||||
|
SELECT count(*) FROM inserts;
|
||||||
|
|
||||||
-- we need this in our next test
|
-- we need this in our next test
|
||||||
truncate raw_events_first;
|
truncate raw_events_first;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue