error on unsupported changing of distirbution column in ON CONFLICT for INSERT ... SELECT

pull/2297/head
Nils Dijk 2018-07-19 15:59:48 +02:00
parent 6a15e1c9fc
commit 2d13900230
No known key found for this signature in database
GPG Key ID: CA1177EF9434F241
3 changed files with 40 additions and 0 deletions

View File

@ -176,6 +176,14 @@ CreateInsertSelectPlan(Query *originalQuery,
PlannerRestrictionContext *plannerRestrictionContext)
{
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,
plannerRestrictionContext);

View File

@ -2735,6 +2735,22 @@ EXECUTE prepared_recursive_insert_select;
EXECUTE prepared_recursive_insert_select;
EXECUTE prepared_recursive_insert_select;
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
BEGIN;
DROP TABLE coerce_events;

View File

@ -2104,6 +2104,22 @@ EXECUTE prepared_recursive_insert_select;
EXECUTE prepared_recursive_insert_select;
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
BEGIN;
DROP TABLE coerce_events;