You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/09/22 16:59:46 UTC

[GitHub] [phoenix] tkhurana commented on a change in pull request #889: PHOENIX-6148 & PHOENIX-6149 : [SchemaExtractionTool] DDL parsing exception in Phoenix…

tkhurana commented on a change in pull request #889:
URL: https://github.com/apache/phoenix/pull/889#discussion_r492893713



##########
File path: phoenix-tools/src/main/java/org/apache/phoenix/schema/SchemaExtractionProcessor.java
##########
@@ -203,6 +203,9 @@ protected String extractCreateViewDDL(PTable table) throws SQLException {
     private String generateCreateViewDDL(String columnInfoString, String baseTableFullName,
             String whereClause, String pSchemaName, String pTableName) {
         String viewFullName = SchemaUtil.getQualifiedTableName(pSchemaName, pTableName);
+        if(Character.isDigit(pTableName.charAt(0))) {

Review comment:
       If you look at the phoenix grammar for create table or create view the table name is of the format below: https://phoenix.apache.org/language/index.html#table_ref
   https://phoenix.apache.org/language/index.html#name
   
   So table names can begin with [A-Z] or _ so any table name that doesn't begin with this has to begin with a quote. So just checking for `isDigit` is wrong as we might miss other cases where the first letter is something other than a digit for example like a `$` or other character. The fix should be if the first character is not a letter or  underscore then quote.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org