mirror of https://github.com/citusdata/citus.git
error on unsupported changing of distirbution column in ON CONFLICT for INSERT ... SELECT
parent
6a15e1c9fc
commit
2d13900230
|
@ -176,6 +176,14 @@ CreateInsertSelectPlan(Query *originalQuery,
|
||||||
PlannerRestrictionContext *plannerRestrictionContext)
|
PlannerRestrictionContext *plannerRestrictionContext)
|
||||||
{
|
{
|
||||||
DistributedPlan *distributedPlan = NULL;
|
DistributedPlan *distributedPlan = NULL;
|
||||||
|
DeferredErrorMessage *deferredError = NULL;
|
||||||
|
|
||||||
|
deferredError = ErrorIfOnConflictNotSupported(originalQuery);
|
||||||
|
if (deferredError != NULL)
|
||||||
|
{
|
||||||
|
/* raising the error as there is no possible solution for the unsupported on conflict statements */
|
||||||
|
RaiseDeferredError(deferredError, ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
distributedPlan = CreateDistributedInsertSelectPlan(originalQuery,
|
distributedPlan = CreateDistributedInsertSelectPlan(originalQuery,
|
||||||
plannerRestrictionContext);
|
plannerRestrictionContext);
|
||||||
|
|
|
@ -2735,6 +2735,22 @@ EXECUTE prepared_recursive_insert_select;
|
||||||
EXECUTE prepared_recursive_insert_select;
|
EXECUTE prepared_recursive_insert_select;
|
||||||
EXECUTE prepared_recursive_insert_select;
|
EXECUTE prepared_recursive_insert_select;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
-- upsert with on conflict update distribution column is unsupported
|
||||||
|
INSERT INTO agg_events AS ae
|
||||||
|
(
|
||||||
|
user_id,
|
||||||
|
value_1_agg,
|
||||||
|
agg_time
|
||||||
|
)
|
||||||
|
SELECT user_id,
|
||||||
|
value_1,
|
||||||
|
time
|
||||||
|
FROM raw_events_first
|
||||||
|
ON conflict (user_id, value_1_agg)
|
||||||
|
DO UPDATE
|
||||||
|
SET user_id = 42
|
||||||
|
RETURNING user_id, value_1_agg;
|
||||||
|
ERROR: modifying the partition value of rows is not allowed
|
||||||
-- wrap in a transaction to improve performance
|
-- wrap in a transaction to improve performance
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DROP TABLE coerce_events;
|
DROP TABLE coerce_events;
|
||||||
|
|
|
@ -2104,6 +2104,22 @@ EXECUTE prepared_recursive_insert_select;
|
||||||
EXECUTE prepared_recursive_insert_select;
|
EXECUTE prepared_recursive_insert_select;
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
|
-- upsert with on conflict update distribution column is unsupported
|
||||||
|
INSERT INTO agg_events AS ae
|
||||||
|
(
|
||||||
|
user_id,
|
||||||
|
value_1_agg,
|
||||||
|
agg_time
|
||||||
|
)
|
||||||
|
SELECT user_id,
|
||||||
|
value_1,
|
||||||
|
time
|
||||||
|
FROM raw_events_first
|
||||||
|
ON conflict (user_id, value_1_agg)
|
||||||
|
DO UPDATE
|
||||||
|
SET user_id = 42
|
||||||
|
RETURNING user_id, value_1_agg;
|
||||||
|
|
||||||
-- wrap in a transaction to improve performance
|
-- wrap in a transaction to improve performance
|
||||||
BEGIN;
|
BEGIN;
|
||||||
DROP TABLE coerce_events;
|
DROP TABLE coerce_events;
|
||||||
|
|
Loading…
Reference in New Issue