Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HustonMmmavr committed Sep 5, 2023
1 parent 0b089c5 commit df14050
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions backup/queries_relations.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,11 @@ func getExcludedRelationOidsList(connectionPool *dbconn.DBConn, quotedIncludeRel

func getOidsFromRelationList(connectionPool *dbconn.DBConn, quotedIncludeRelations []string) []string {
relList := utils.SliceToQuotedString(quotedIncludeRelations)

// is this solution correct for cases with include
query := fmt.Sprintf(`
WITH root_oids AS (
SELECT c.oid AS a
FROM pg_class c
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE quote_ident(n.nspname) || '.' || quote_ident(c.relname) IN (%s)
)
SELECT a FROM root_oids
UNION
SELECT r.parchildrelid as string
FROM pg_partition p join pg_partition_rule r on p.oid = r.paroid
join root_oids oids on p.parrelid = oids.a WHERE r.parchildrelid != 0
`, relList)
SELECT c.oid AS string
FROM pg_class c
JOIN pg_namespace n ON c.relnamespace = n.oid
WHERE quote_ident(n.nspname) || '.' || quote_ident(c.relname) IN (%s)`, relList)
return dbconn.MustSelectStringSlice(connectionPool, query)
}

Expand Down

0 comments on commit df14050

Please sign in to comment.