virajjasani commented on code in PR #1669:
URL: https://github.com/apache/phoenix/pull/1669#discussion_r1321912957


##########
phoenix-core/src/it/java/org/apache/phoenix/end2end/ViewIT.java:
##########
@@ -896,6 +899,66 @@ public void testCompositeDescPK() throws Exception {
         }
     }
 
+    @Test
+    //creating view with same name on top of a table with a non existent column
+    public void testCreateViewWithUndefinedSameColumnName() throws Exception {
+        try (Connection conn = DriverManager.getConnection(getUrl());
+             Statement stmt = conn.createStatement()) {
+
+            String fullViewName = generateUniqueName();
+            String ddl = "CREATE VIEW " + fullViewName +
+                    " AS SELECT * FROM " + fullViewName +
+                    " WHERE " + fullViewName + " = 1";
+            stmt.execute(ddl);
+            fail("Should have thrown an exception");
+        } catch (ColumnNotFoundException columnException) {
+            assertEquals("Undefined column",
+                    SQLExceptionCode.COLUMN_NOT_FOUND
+                    .getErrorCode(), columnException.getErrorCode());

Review Comment:
   let's also assert the value of `ColumnNotFoundException#getColumnName`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to