Github user twdsilva commented on a diff in the pull request: https://github.com/apache/phoenix/pull/303#discussion_r201748315 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java --- @@ -1957,6 +1968,17 @@ private PTable createTableInternal(CreateTableStatement statement, byte[][] spli linkStatement.setLong(6, parent.getSequenceNumber()); linkStatement.setString(7, PTableType.INDEX.getSerializedValue()); linkStatement.execute(); + + // Add row linking index table to parent table for indexes on views + if (parent.getType() == PTableType.VIEW) { + linkStatement = connection.prepareStatement(CREATE_VIEW_INDEX_PARENT_LINK); + linkStatement.setString(1, tenantIdStr); + linkStatement.setString(2, schemaName); + linkStatement.setString(3, tableName); + linkStatement.setString(4, parent.getName().getString()); + linkStatement.setByte(5, LinkType.VIEW_INDEX_PARENT_TABLE.getSerializedValue()); + linkStatement.execute(); + } --- End diff -- I created PHOENIX-4766 for this, I will add a comment referencing this JIRA in createTableInternal().
---