An Error Is Reported When Data Is Inserted or Updated, Indicating that the Distribution Key Cannot Be Updated
Symptom
An error is reported when data is inserted or updated, indicating that the distribution key cannot be updated. The following is the error message:
1
|
ERROR: Distributed key column can't be updated in current version |
Possible Causes
The GaussDB(DWS) distribution key cannot be updated.
Handling Procedure
Method 1: The distribution key cannot be updated. Ignore the error.
Method 2: Change the distribution column to a column that cannot be updated. (In versions later than 8.1.0, the distribution column can be changed.) For example:
- Query the table definition. The command output shows that the distribution column of the table is c_last_name.
1
SELECT pg_get_tabledef('customer_t1');
- Try updating data in the distribution column. An error message will be displayed.
1
UPDATE customer_t1 SET c_last_name = 'Jimy' WHERE c_customer_sk = 6885;
- Change the distribution column of the table to a column that cannot be updated, for example, c_customer_sk.
1
ALTER TABLE customer_t1 DISTRIBUTE BY hash (c_customer_sk);
- Update the data in the old distribution column.
1
UPDATE customer_t1 SET c_last_name = 'Jimy'WHERE c_customer_sk = 6885;
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot