Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pkg/crosscluster/logical/logical_replication_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ func TestLogicalReplicationCreationChecks(t *testing.T) {
// Check that REFCURSOR columns are not allowed.
dbA.Exec(t, "CREATE TABLE tab_with_refcursor (pk INT PRIMARY KEY, curs REFCURSOR)")
dbB.Exec(t, "CREATE TABLE b.tab_with_refcursor (pk INT PRIMARY KEY, curs REFCURSOR)")
expectErr(t, "tab_with_refcursor", "cannot create logical replication stream: column curs is a RefCursor")
expectErr(t, "tab_with_refcursor", "cannot create logical replication stream: RefCursor is not supported by LDR")

// Add different default values to to the source and dest, verify the stream
// can be created, and that the default value is sent over the wire.
Expand Down
28 changes: 23 additions & 5 deletions pkg/sql/catalog/tabledesc/logical_replication_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,30 @@ func CheckLogicalReplicationCompatibility(
}

func checkForbiddenTypes(dst *descpb.TableDescriptor) error {
var isForbiddenType func(typ *types.T) error
isForbiddenType = func(typ *types.T) error {
switch typ.Family() {
case types.RefCursorFamily:
// RefCursor is not supported by LDR because it has no definition of
// equality. It's a weird type that should never exist in a durable table
// since a cursor is a session scoped entity.
return errors.Newf("RefCursor is not supported by LDR")
case types.ArrayFamily:
return isForbiddenType(typ.ArrayContents())
case types.TupleFamily:
for _, tupleTyp := range typ.TupleContents() {
if err := isForbiddenType(tupleTyp); err != nil {
return err
}
}
return nil
default:
return nil
}
}
for _, col := range dst.Columns {
// RefCursor is not supported by LDR because it has no definition of
// equality. It's a weird type that should never exist in a durable table
// since a cursor is a session scoped entity.
if col.Type.Family() == types.RefCursorFamily {
return errors.Newf("column %s is a RefCursor", col.Name)
if err := isForbiddenType(col.Type); err != nil {
return err
}
}
return nil
Expand Down