PHOENIX-5668: Add Full table name to the error message for constraint violation exceptions

Signed-off-by: Xinyi Yan <xyan@salesforce.com>
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
index 59b15d8..815e894 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
@@ -393,6 +393,7 @@
             fail();
         } catch (SQLException e) {
             assertEquals(SQLExceptionCode.CONSTRAINT_VIOLATION.getErrorCode(), e.getErrorCode());
+            assertTrue(e.getMessage().contains(table));
         }
 
         dml = "UPSERT INTO " + table + " VALUES (1, 2)";
@@ -401,6 +402,7 @@
             fail();
         } catch (SQLException e) {
             assertEquals(SQLExceptionCode.CONSTRAINT_VIOLATION.getErrorCode(), e.getErrorCode());
+            assertTrue(e.getMessage().contains(table));
         }
 
         dml = "UPSERT INTO " + table + " VALUES (1, 2, 3)";
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
index 8e7aa05..97447f2 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
@@ -523,7 +523,8 @@
             for (i = posOffset; i < table.getColumns().size(); i++) {
                 PColumn column = table.getColumns().get(i);
                 if (!columnsBeingSet.get(i) && !column.isNullable() && column.getExpressionStr() == null) {
-                    throw new ConstraintViolationException(SchemaUtil.getColumnDisplayName(column) + " may not be null");
+                    throw new ConstraintViolationException(table.getName().getString() + "."
+                            + SchemaUtil.getColumnDisplayName(column) + " may not be null");
                 }
             }
         }
@@ -621,7 +622,8 @@
             for (int i = posOffset + nValuesToSet; i < table.getColumns().size(); i++) {
                 PColumn column = table.getColumns().get(i);
                 if (!column.isNullable() && column.getExpressionStr() == null) {
-                    throw new ConstraintViolationException(SchemaUtil.getColumnDisplayName(column) + " may not be null");
+                    throw new ConstraintViolationException(table.getName().getString() + "."
+                            + SchemaUtil.getColumnDisplayName(column) + " may not be null");
                 }
             }
         }