Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
makalaaneesh committed Feb 2, 2024
1 parent afda6c2 commit a455ee6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions yb-voyager/cmd/exportData.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ func getPGDumpSequencesAndValues() (map[*sqlname.SourceName]int64, error) {
return nil, fmt.Errorf("invalid index %d for matches - %s for line %s", argsIdx, matches, line)
}
args := strings.Split(matches[argsIdx], ",")
utils.PrintAndLog("ARGS %s", args)

seqNameRaw := args[0][1 : len(args[0])-1]
seqName := sqlname.NewSourceNameFromQualifiedName(seqNameRaw)
Expand All @@ -343,6 +344,12 @@ func getPGDumpSequencesAndValues() (map[*sqlname.SourceName]int64, error) {
return nil, fmt.Errorf("parse %s to int in line - %s: %v", args[1], line, err)
}

isCalled := strings.TrimSpace(args[2])
if isCalled == "false" {
// we always restore sequences with is_called=true, therefore, we need to minus 1.
seqVal--
}

result[seqName] = seqVal
}
return result, nil
Expand Down
3 changes: 2 additions & 1 deletion yb-voyager/src/srcdb/yugabytedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ func (yb *YugabyteDB) GetColumnToSequenceMap(tableList []*sqlname.SourceName) ma
utils.ErrExit("Error in scanning for sequences in table=%s: %v", table, err)
}
qualifiedColumnName := fmt.Sprintf("%s.%s", table.Qualified.Unquoted, columeName)
columnToSequenceMap[qualifiedColumnName] = schemaName + "." + sequenceName
// quoting sequence name as it can be case sensitive - required during import data restore sequences
columnToSequenceMap[qualifiedColumnName] = fmt.Sprintf(`%s."%s"`, schemaName, sequenceName)
}
}

Expand Down

0 comments on commit a455ee6

Please sign in to comment.