You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2026/03/13 21:19:57 UTC

[XS] Change in asterixdb[lumina]: WIP: Changing the error when updating a primary key

From Shahrzad Shirazi <Sh...@couchbase.com>:

Shahrzad Shirazi has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21008?usp=email )


Change subject: WIP: Changing the error when updating a primary key
......................................................................

WIP: Changing the error when updating a primary key

Change-Id: Ic719d4b53ad12bd06f46db11803333a52c5f2982
---
M asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
M asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
M asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppChangeExprToSelectExprVisitor.java
3 files changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/08/21008/1

diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index dd8d358..0178305 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -348,6 +348,7 @@
     NO_VALID_CREDENTIALS_PROVIDED_FOR_BIGLAKE_METASTORE_CATALOG(1240),
     INVALID_FRAME_BASED_MEMORY_BUDGET(1241),
     COLLECTION_IS_NOT_AN_ICEBERG_TABLE_COLLECTION(1242),
+    UPDATE_PRIMARY_KEY(1243),
 
     // Feed errors
     DATAFLOW_ILLEGAL_STATE(3001),
diff --git a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index 23a66ff..6400ffe 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -350,6 +350,7 @@
 1240 = No valid credentials provided to access Biglake Metastore catalog.
 1241 = Invalid `%1$s` "%2$s" for frame size=%3$s. value should be >= %4$s * frame size: `%1$s` "%5$s" in %6$s
 1242 = Collection '%1$s' is not an Iceberg table external collection.
+1243 = %s is a primary key and should not be updated
 
 # Feed Errors
 3001 = Illegal state.
diff --git a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppChangeExprToSelectExprVisitor.java b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppChangeExprToSelectExprVisitor.java
index 90682ae..7d068e9 100644
--- a/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppChangeExprToSelectExprVisitor.java
+++ b/asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/rewrites/visitor/SqlppChangeExprToSelectExprVisitor.java
@@ -164,7 +164,7 @@
         for (Expression pathExpr : pathExprList) {
             try {
                 if (isPrimaryKeyField(pathExpr, fieldPath)) {
-                    throw new CompilationException("Cannot set primary key field: " + pathExpr);
+                    throw new CompilationException(ErrorCode.UPDATE_PRIMARY_KEY, pathExpr.toString());
                 }
             } catch (AlgebricksException e) {
                 throw new RuntimeException(e);

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21008?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: lumina
Gerrit-Change-Id: Ic719d4b53ad12bd06f46db11803333a52c5f2982
Gerrit-Change-Number: 21008
Gerrit-PatchSet: 1
Gerrit-Owner: Shahrzad Shirazi <Sh...@couchbase.com>