pgDumpUsable mirrors PGDumpSchemaOnly's requirement (pg_dump on PATH at v13 or later). PGDumpSchemaOnly silently falls back to `docker run` when either condition fails, so we only show the install hint here when the local pg_dump is genuinely unusable. Otherwise an old pg_dump would produce a mislea
()
| 131 | // local pg_dump is genuinely unusable. Otherwise an old pg_dump would |
| 132 | // produce a misleading Docker-not-found message. |
| 133 | func pgDumpUsable() bool { |
| 134 | path, err := exec.LookPath("pg_dump") |
| 135 | if err != nil { |
| 136 | return false |
| 137 | } |
| 138 | out, err := exec.Command(path, "--version").Output() |
| 139 | if err != nil { |
| 140 | return false |
| 141 | } |
| 142 | // Output format: "pg_dump (PostgreSQL) 14.5 ..." |
| 143 | parts := strings.Fields(string(out)) |
| 144 | if len(parts) < 3 { |
| 145 | return false |
| 146 | } |
| 147 | major, err := strconv.Atoi(strings.SplitN(parts[2], ".", 2)[0]) |
| 148 | if err != nil { |
| 149 | return false |
| 150 | } |
| 151 | return major >= 13 |
| 152 | } |
| 153 | |
| 154 | func openEmbeddedPostgres() (string, func(), error) { |
| 155 | listener, err := net.Listen("tcp4", "127.0.0.1:0") |