447961 {
447962 if (entry.temporary || entry.Parent().temporary) {
447963 return;
447964 }
447965
447966
447967 auto &parent = entry.Parent();
447968
447969 switch (parent.type) {
447970 case CatalogType::TABLE_ENTRY:
447971 case CatalogType::VIEW_ENTRY:
447972 case CatalogType::INDEX_ENTRY:
447973 case CatalogType::SEQUENCE_ENTRY:
447974 case CatalogType::TYPE_ENTRY:
447975 case CatalogType::MACRO_ENTRY:
447976 case CatalogType::TABLE_MACRO_ENTRY:
447977 if (entry.type == CatalogType::RENAMED_ENTRY || entry.type == parent.type) {
447978
447979 auto extra_data_size = Load<idx_t>(dataptr);
447980 auto extra_data = data_ptr_cast(dataptr +
sizeof(
idx_t));
447981
447982 MemoryStream source(extra_data, extra_data_size);
447983 BinaryDeserializer deserializer(source);
447984 deserializer.Begin();
447985 auto column_name = deserializer.ReadProperty<string>(100, "column_name");
447986 auto parse_info = deserializer.ReadProperty<unique_ptr<ParseInfo>>(101, "alter_info");
447987 deserializer.End();
447988
447989 auto &alter_info = parse_info->Cast<AlterInfo>();
447990 log.WriteAlter(entry, alter_info);
447991 } else {
447992 switch (parent.type) {
447993 case CatalogType::TABLE_ENTRY:
447994
447995 log.WriteCreateTable(parent.Cast<TableCatalogEntry>());
447996 break;
447997 case CatalogType::VIEW_ENTRY:
447998
447999 log.WriteCreateView(parent.Cast<ViewCatalogEntry>());
448000 break;
448001 case CatalogType::INDEX_ENTRY:
448002
448003 log.WriteCreateIndex(parent.Cast<IndexCatalogEntry>());
448004 break;
448005 case CatalogType::SEQUENCE_ENTRY:
448006
448007 log.WriteCreateSequence(parent.Cast<SequenceCatalogEntry>());
448008 break;
448009 case CatalogType::TYPE_ENTRY:
448010
448011 log.WriteCreateType(parent.Cast<TypeCatalogEntry>());
448012 break;
448013 case CatalogType::MACRO_ENTRY:
448014 log.WriteCreateMacro(parent.Cast<ScalarMacroCatalogEntry>());
448015 break;
448016 case CatalogType::TABLE_MACRO_ENTRY:
448017 log.WriteCreateTableMacro(parent.Cast<TableMacroCatalogEntry>());
448018 break;
448019 default:
448020 throw InternalException("Don't know how to create this type!");
448021 }
448022 }
448023 break;
448024 case CatalogType::SCHEMA_ENTRY:
448025 if (entry.type == CatalogType::RENAMED_ENTRY || entry.type == CatalogType::SCHEMA_ENTRY) {
448026
448027 return;
448028 }
448029 log.WriteCreateSchema(parent.Cast<SchemaCatalogEntry>());
448030 break;
448031 case CatalogType::RENAMED_ENTRY:
448032
448033 break;
448034 case CatalogType::DELETED_ENTRY:
448035 switch (entry.type) {
448036 case CatalogType::TABLE_ENTRY: {
448037 auto &table_entry = entry.Cast<DuckTableEntry>();
448038 D_ASSERT(table_entry.IsDuckTable());
448039 log.WriteDropTable(table_entry);
448040 break;
448041 }
448042 case CatalogType::SCHEMA_ENTRY:
448043 log.WriteDropSchema(entry.Cast<SchemaCatalogEntry>());
448044 break;
448045 case CatalogType::VIEW_ENTRY:
448046 log.WriteDropView(entry.Cast<ViewCatalogEntry>());
448047 break;
448048 case CatalogType::SEQUENCE_ENTRY:
448049 log.WriteDropSequence(entry.Cast<SequenceCatalogEntry>());
448050 break;
448051 case CatalogType::MACRO_ENTRY:
448052 log.WriteDropMacro(entry.Cast<ScalarMacroCatalogEntry>());
448053 break;
448054 case CatalogType::TABLE_MACRO_ENTRY:
448055 log.WriteDropTableMacro(entry.Cast<TableMacroCatalogEntry>());
448056 break;
448057 case CatalogType::TYPE_ENTRY:
448058 log.WriteDropType(entry.Cast<TypeCatalogEntry>());
448059 break;
448060 case CatalogType::INDEX_ENTRY: {
448061 log.WriteDropIndex(entry.Cast<IndexCatalogEntry>());
448062 break;
448063 }
448064 case CatalogType::RENAMED_ENTRY:
448065 case CatalogType::PREPARED_STATEMENT:
448066 case CatalogType::SCALAR_FUNCTION_ENTRY:
448067 case CatalogType::DEPENDENCY_ENTRY:
448068 case CatalogType::SECRET_ENTRY:
448069 case CatalogType::SECRET_TYPE_ENTRY:
448070 case CatalogType::SECRET_FUNCTION_ENTRY:
448071
448072 break;
448073 default:
448074 throw InternalException("Don't know how to drop this type!");
448075 }
448076 break;
448077 case CatalogType::PREPARED_STATEMENT:
448078 case CatalogType::AGGREGATE_FUNCTION_ENTRY:
448079 case CatalogType::SCALAR_FUNCTION_ENTRY:
448080 case CatalogType::TABLE_FUNCTION_ENTRY:
448081 case CatalogType::COPY_FUNCTION_ENTRY:
448082 case CatalogType::PRAGMA_FUNCTION_ENTRY:
448083 case CatalogType::COLLATION_ENTRY:
448084 case CatalogType::COORDINATE_SYSTEM_ENTRY:
448085 case CatalogType::DEPENDENCY_ENTRY:
448086 case CatalogType::SECRET_ENTRY:
448087 case CatalogType::SECRET_TYPE_ENTRY:
448088 case CatalogType::SECRET_FUNCTION_ENTRY:
448089
448090 break;
448091 default:
448092 throw InternalException("UndoBuffer - don't know how to write this entry to the WAL");
448093 }
448094}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237