Skip to content
This repository was archived by the owner on Dec 22, 2025. It is now read-only.
Open
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
14 changes: 13 additions & 1 deletion pkg/reader/postgres/pg_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package postgres
import (
"bytes"
"os/exec"
"strings"

log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -55,5 +56,16 @@ func (p *PgDump) GetStructure() (string, error) {
logger.Error("failed to load schema for table")
}

return buf.String(), nil
// Process the output to drop lines starting with /restrict or /unrestrict
output := buf.String()
lines := strings.Split(output, "\n")
filteredLines := make([]string, 0, len(lines))
for _, line := range lines {
trimmed := strings.TrimSpace(line)
if !strings.HasPrefix(trimmed, `\restrict`) && !strings.HasPrefix(trimmed, `\unrestrict`) {
filteredLines = append(filteredLines, line)
}
}

return strings.Join(filteredLines, "\n"), nil
}