diff --git a/src/yb/docdb/docdb_compaction_context.cc b/src/yb/docdb/docdb_compaction_context.cc index 9127d9ec2006..e764f105844d 100644 --- a/src/yb/docdb/docdb_compaction_context.cc +++ b/src/yb/docdb/docdb_compaction_context.cc @@ -376,7 +376,7 @@ class PackedRowData { column_id)); return CheckPackOldValueResult( column_id, std::visit([column_id, missing_value](auto& packer) { - return packer.AddValue(column_id, missing_value); + return packer.AddValue(column_id, missing_value, kUnlimitedTail); }, *packer_)); } return DoPackOldValue(column_id, decoder.FetchValue(decoder.GetPackedIndex(column_id))); diff --git a/src/yb/dockv/packed_row.cc b/src/yb/dockv/packed_row.cc index 62b9d5ca52de..9732818315a5 100644 --- a/src/yb/dockv/packed_row.cc +++ b/src/yb/dockv/packed_row.cc @@ -432,8 +432,8 @@ void RowPackerV1::Init(SchemaVersion version) { result_.Truncate(prefix_end_); } -Result RowPackerV1::AddValue(ColumnId column_id, const QLValuePB& value) { - return DoAddValue(column_id, value, /* tail_size= */ 0); +Result RowPackerV1::AddValue(ColumnId column_id, const QLValuePB& value, ssize_t tail_size) { + return DoAddValue(column_id, value, tail_size); } Result RowPackerV1::AddValue(ColumnId column_id, const LWQLValuePB& value) { @@ -519,8 +519,9 @@ Result RowPackerV2::AddValue( return DoAddValue(column_id, std::pair(value_prefix, value_suffix), tail_size); } -Result RowPackerV2::AddValue(ColumnId column_id, const QLValuePB& value) { - return DoAddValue(column_id, value, /* tail_size= */ 0); +Result RowPackerV2::AddValue( + ColumnId column_id, const QLValuePB& value, ssize_t tail_size) { + return DoAddValue(column_id, value, tail_size); } Result RowPackerV2::AddValue(ColumnId column_id, const LWQLValuePB& value) { diff --git a/src/yb/dockv/packed_row.h b/src/yb/dockv/packed_row.h index 7f139a773a75..3bb645ef71c0 100644 --- a/src/yb/dockv/packed_row.h +++ b/src/yb/dockv/packed_row.h @@ -164,7 +164,7 @@ class RowPackerV1 : public RowPackerBase { // Add value consisting of 2 parts - value_prefix+value_suffix. Result AddValue( ColumnId column_id, Slice value_prefix, PackedValueV1 value_suffix, ssize_t tail_size); - Result AddValue(ColumnId column_id, const QLValuePB& value); + Result AddValue(ColumnId column_id, const QLValuePB& value, ssize_t tail_size = 0); Result AddValue(ColumnId column_id, const LWQLValuePB& value); Result AddValue(ColumnId column_id, Slice control_fields, const QLValuePB& value); Result AddValue(ColumnId column_id, const PackableValue& value); @@ -207,7 +207,7 @@ class RowPackerV2 : public RowPackerBase { // Add value consisting of 2 parts - value_prefix+value_suffix. Result AddValue( ColumnId column_id, Slice value_prefix, PackedValueV1 value_suffix, ssize_t tail_size); - Result AddValue(ColumnId column_id, const QLValuePB& value); + Result AddValue(ColumnId column_id, const QLValuePB& value, ssize_t tail_size = 0); Result AddValue(ColumnId column_id, const LWQLValuePB& value); Result AddValue(ColumnId column_id, const PackableValue& value); diff --git a/src/yb/yql/pgwrapper/pg_packed_row-test.cc b/src/yb/yql/pgwrapper/pg_packed_row-test.cc index 4b50431594d9..4ec5692eaf58 100644 --- a/src/yb/yql/pgwrapper/pg_packed_row-test.cc +++ b/src/yb/yql/pgwrapper/pg_packed_row-test.cc @@ -690,6 +690,10 @@ TEST_P(PgPackedRowTest, PackOverflow) { ASSERT_OK(conn.Execute("ALTER TABLE t ADD COLUMN v2 TEXT")); ASSERT_OK(cluster_->CompactTablets()); + + ASSERT_OK(conn.Execute("ALTER TABLE t ADD COLUMN v3 TIMESTAMP DEFAULT CURRENT_TIMESTAMP NULL")); + + ASSERT_OK(cluster_->CompactTablets()); } TEST_P(PgPackedRowTest, AddDropColumn) {