Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -964,12 +964,15 @@ private void addColumnMutation(String schemaName, String tableName, PColumn colu
} else {
colUpsert.setString(18, column.getExpressionStr());
}
if (column.getColumnQualifierBytes() == null) {
colUpsert.setNull(19, Types.VARBINARY);
} else {
colUpsert.setBytes(19, column.getColumnQualifierBytes());
//Do not try to set extra columns when using ALTER_SYSCATALOG_TABLE_UPGRADE
if (colUpsert.getParameterMetaData().getParameterCount() > 18) {
if (column.getColumnQualifierBytes() == null) {
colUpsert.setNull(19, Types.VARBINARY);
} else {
colUpsert.setBytes(19, column.getColumnQualifierBytes());
}
colUpsert.setBoolean(20, column.isRowTimestamp());
}
colUpsert.setBoolean(20, column.isRowTimestamp());
colUpsert.execute();
}

Expand DownExpand Up@@ -3947,7 +3950,10 @@ public MutationState addColumn(PTable table, List<ColumnDef> origColumnDefs,
Map<String, Integer> changedCqCounters = new HashMap<>(numCols);
if (numCols > 0 ) {
StatementContext context = new StatementContext(new PhoenixStatement(connection), resolver);
String addColumnSqlToUse = INSERT_COLUMN_CREATE_TABLE;
String addColumnSqlToUse = connection.isRunningUpgrade()
&& tableName.equals(PhoenixDatabaseMetaData.SYSTEM_CATALOG_TABLE)
&& schemaName.equals(PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA) ? ALTER_SYSCATALOG_TABLE_UPGRADE
: INSERT_COLUMN_CREATE_TABLE;
try (PreparedStatement colUpsert = connection.prepareStatement(addColumnSqlToUse)) {
short nextKeySeq = SchemaUtil.getMaxKeySeq(table);
for ( ColumnDef colDef : columnDefs) {
Expand Down