This is an automated email from the ASF dual-hosted git repository.
gfphoenix78 pushed a commit to branch sync-with-upstream
in repository https://gitbox.apache.org/repos/asf/cloudberry-gpbackup.git
The following commit(s) were added to refs/heads/sync-with-upstream by this
push:
new 3cd0f88d fix(backup): Enable modern sequence and constraint features
for Cloudberry (#35)
3cd0f88d is described below
commit 3cd0f88d8c2a7c7b90783a1598bca7059af5753c
Author: Robert Mu <[email protected]>
AuthorDate: Fri Sep 5 15:11:47 2025 +0800
fix(backup): Enable modern sequence and constraint features for Cloudberry
(#35)
The logic for handling modern sequence definitions (`AS <type>`) and
renaming constraints on exchanged partitions was previously gated for
GPDB 7+ only.
This caused incorrect backups on Cloudberry, which supports these
modern PostgreSQL capabilities but was not included in the version check.
Consequently, sequence types could be lost, and exchanged partition
constraints could have incorrect names, leading to potential restore
failures.
This commit updates the version checks to the standard
`(IsGPDB() && AtLeast("7")) || IsCBDB()` pattern. This ensures these
critical features execute correctly for Cloudberry, improving backup
correctness and reliability.
---
backup/predata_relations.go | 3 ++-
backup/wrappers.go | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/backup/predata_relations.go b/backup/predata_relations.go
index a2b6a670..98257551 100644
--- a/backup/predata_relations.go
+++ b/backup/predata_relations.go
@@ -318,7 +318,8 @@ func generateSequenceDefinitionStatement(sequence Sequence)
string {
minVal := int64(math.MinInt64)
// Identity columns cannot be defined with `AS smallint/integer`
- if connectionPool.Version.AtLeast("7") &&
sequence.OwningColumnAttIdentity == "" {
+ if ((connectionPool.Version.IsGPDB() &&
connectionPool.Version.AtLeast("7")) || connectionPool.Version.IsCBDB()) &&
+ sequence.OwningColumnAttIdentity == "" {
if definition.Type != "bigint" {
statement += fmt.Sprintf("\n\tAS %s", definition.Type)
}
diff --git a/backup/wrappers.go b/backup/wrappers.go
index 1898897a..fd0f39a7 100644
--- a/backup/wrappers.go
+++ b/backup/wrappers.go
@@ -273,7 +273,8 @@ func retrieveAndBackupTypes(metadataFile
*utils.FileWithByteCount, sortables *[]
func retrieveConstraints(sortables *[]Sortable, metadataMap MetadataMap,
tables ...Relation) ([]Constraint, []Constraint, MetadataMap) {
gplog.Verbose("Retrieving constraints")
constraints := GetConstraints(connectionPool, tables...)
- if len(constraints) > 0 && connectionPool.Version.AtLeast("7") {
+ if len(constraints) > 0 && ((connectionPool.Version.IsGPDB() &&
connectionPool.Version.AtLeast("7")) ||
+ connectionPool.Version.IsCBDB()) {
RenameExchangedPartitionConstraints(connectionPool,
&constraints)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]