Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
126351: Cannot restore backup unknown type kind COMPOSITE r=Dedej-Bergin a=Dedej-Bergin

Added the handling for the composite type case.

Fixes: cockroachdb#125550

Release note (bug fix): Fixed a bug that made it impossible to restore a database that contains a composite type.

Co-authored-by: Bergin Dedej <bergin.dedej@cockroachlabs.com>
  • Loading branch information
craig[bot] and Dedej-Bergin committed Jun 28, 2024
2 parents a162540 + ad50493 commit ff679af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/ccl/backupccl/testdata/backup-restore/user-defined-types
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ exec-sql
CREATE TYPE d.farewell AS ENUM ('bye', 'cya');
----

exec-sql
CREATE TYPE d.roach_status AS (queen_roach UUID, king_roach UUID, worker_roach INT);
----

exec-sql
CREATE TABLE d.t1 (x d.greeting);
----
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/catalog/rewrite/rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ func TypeDescs(types []*typedesc.Mutable, descriptorRewrites jobspb.DescRewriteM
}
}
switch t := typ.Kind; t {
case descpb.TypeDescriptor_ENUM, descpb.TypeDescriptor_MULTIREGION_ENUM:
case descpb.TypeDescriptor_ENUM, descpb.TypeDescriptor_COMPOSITE, descpb.TypeDescriptor_MULTIREGION_ENUM:
if rw, ok := descriptorRewrites[typ.ArrayTypeID]; ok {
typ.ArrayTypeID = rw.ID
}
Expand Down

0 comments on commit ff679af

Please sign in to comment.