stoty commented on code in PR #1586:
URL: https://github.com/apache/phoenix/pull/1586#discussion_r1164041190


##########
phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java:
##########
@@ -2563,13 +2618,17 @@ private static void 
updateIndexesSequenceIfPresent(PhoenixConnection connection,
         String newSchemaName = 
MetaDataUtil.getViewIndexSequenceSchemaName(physicalName, true);
         String newSequenceName = 
MetaDataUtil.getViewIndexSequenceName(physicalName, tenantId, true);
         // create new entry with new schema format
-        String upsert = "UPSERT INTO " + 
PhoenixDatabaseMetaData.SYSTEM_SEQUENCE + " SELECT NULL,\'" + newSchemaName +
-            "\',\'" + newSequenceName
-                + "\'," + START_WITH + "," + CURRENT_VALUE + "," + 
INCREMENT_BY + "," + CACHE_SIZE + "," + MIN_VALUE
-                + "," + MAX_VALUE + "," + CYCLE_FLAG + "," + 
LIMIT_REACHED_FLAG + " FROM "
-                + PhoenixDatabaseMetaData.SYSTEM_SEQUENCE + " WHERE " + 
PhoenixDatabaseMetaData.TENANT_ID
-                + " IS NULL AND " + PhoenixDatabaseMetaData.SEQUENCE_SCHEMA + 
" = '" + oldSchemaName + "'";
-        connection.createStatement().executeUpdate(upsert);
+        String upsert = "UPSERT INTO " + 
PhoenixDatabaseMetaData.SYSTEM_SEQUENCE
+            + " SELECT NULL,\'" + newSchemaName + "\',\'" + newSequenceName

Review Comment:
   I am quite baffled why spotbug doesn't flag this.
   I wouldn't expect spotbugs to actually parse the SQL.
   TBH most of these fixes are closing theoretical holes rather than real 
explaoitable issues.
   However, the point of doing is to make sure that we are protected even if 
other parts of the code let an exploit through, so I think that we should be 
thorough.
   
   Besides, this a super simple fix, there are no nulls or variable length 
lists here.
   



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