350867 {
350868 vector<PivotColumnEntry> result;
350869
350870 if (serializer.ShouldSerialize(7)) {
350871
350872
350873 for (
auto &entry :
entries) {
350874 result.push_back(entry.Copy());
350875 }
350876 return result;
350877 }
350878
350879
350881
350882 for (
auto &entry :
entries) {
350883 auto result_entry = entry.Copy();
350884 if (!entry.expr) {
350885
350886 result.push_back(std::move(result_entry));
350887 continue;
350888 }
350889
350890
350891 vector<Value> folded_values;
350892 if (TryFoldForBackwardsCompatibility(result_entry.expr, folded_values)) {
350893
350894 result_entry.values = std::move(folded_values);
350895 result_entry.expr.reset();
350896 result.push_back(std::move(result_entry));
350897 continue;
350898 }
350899
350900
350901 if (is_unpivot) {
350902 result.push_back(std::move(result_entry));
350903 continue;
350904 }
350905
350906
350907
350908 const auto target_version = serializer.GetOptions().serialization_compatibility.duckdb_version;
350909
350910 throw SerializationException(
350911 "Cannot serialize non-constant expression '%s' in pivot list when targeting database storage version '%s'",
350912 entry.expr->ToString(), target_version);
350913 }
350914
350915 return result;
350916}