ankane/pgsync · error · Error
pg_restore not found
Error message
pg_restore not found
What it means
Error "pg_restore not found" thrown in ankane/pgsync.
Source
Thrown at lib/pgsync/schema_sync.rb:75
private
def run_command(dump_command, restore_command)
err_r, err_w = IO.pipe
Open3.pipeline_start(dump_command, restore_command, err: err_w) do |wait_thrs|
err_w.close
err_r.each do |line|
yield line
end
wait_thrs.all? { |t| t.value.success? }
end
end
# --if-exists introduced in Postgres 9.4
# not ideal, but simpler than trying to parse version
def supports_if_exists?
`pg_restore --help`.include?("--if-exists")
rescue Errno::ENOENT
raise Error, "pg_restore not found"
end
def dump_command
cmd = ["pg_dump", "-Fc", "--verbose", "--schema-only", "--no-owner", "--no-acl"]
if specify_tables?
@tasks.each do |task|
cmd.concat(["-t", task.quoted_table])
end
end
cmd.concat(["-d", @source.url])
end
def restore_command
cmd = ["pg_restore", "--verbose", "--no-owner", "--no-acl", "--clean"]
cmd << "--if-exists" if supports_if_exists?
cmd.concat(["-d", @destination.url])
end
View on GitHub (pinned to 57bdddf5db)
When it happens
Trigger: Thrown at lib/pgsync/schema_sync.rb:75 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ankane/pgsync@57bdddf5db (2026-08-23).
Data as JSON: /api/errors/4565ad197fbcf417.
Report an issue: GitHub.