5 ms·
That seems strange, the only incompatibilities between major versions are generally only the catalogs. I don't remember any version whose storage format is can
by mattashii 4y ago
That seems strange, the only incompatibilities between major versions are generally only the catalogs.
I don't remember any version whose storage format is cannot be read by the next versions (none since 2010). Could you add some more info what issues you had?
- 411111111111111 4y agoIn not the person you've responded to but I've never been able to get `pg_dump -Fc` and restore to work across versions. It always errors out for me, saying it's an invalid/broken backup. Super annoying because now the workflow is 1. Start old version just to restore, remove old version and start new version for upgrade.
- castorp 4y agoYou need to use pg_dump from the new version, not from the old version.
- jasfi 4y agoI think you found a common stumbling block. The tutorial people follow may say to run pg_dump and many people would assume you're running it from the old version.
- rapind 4y agoWait, what? Explain please. OK upon further thought, what you're saying is to use the pg_dump tool that comes with the pg version you are upgrading to. I read it as "use pg_dump instead of pg_restore"...
- mh- 4y agoYes. Put concisely: Use the client tools from the newest version involved for all steps.
- oblio 4y agoIsn't that impractical for most Linux distros? You'd need to manually install the new client.
- mh- 4y agoProbably? Certainly if you rely on distro packaging for it, yes. I was just trying to simplify the guidance here. :)
- BGZq7 4y agoOn Debian (and probably most of its derivatives), the package manager will not remove any running PostgreSQL versions and will let you have multiple versions side by side. It also has its own tool pg_upgradecluster, which can perform the upgrade using pg_dump+pg_restore or pg_upgrade (optionally with link or clone options).
- autra 4y agoYes, and usually, it means you need to use the full binary path unfortunately (because debian wrappers embedded in the package select the version from your 5432 cluster).
- forinti 4y agoI've used dumps as backups and never experienced this issue, although they would stop prematurely from time to time. The solution was just to check the string at the end and repeat the dump if it wasn't there.
- 411111111111111 4y agoConsidering that -Fc is a binary format, how would i check a string at the end of it?
- forinti 4y agoIf you do an SQL dump, it will end with "-- PostgreSQL database dump complete". If you use -Fc, you can make an SQL file from the dump using pg_restore like this: pg_restore -f db.sql db.dmp Or straight to stdout like this: pg_restore -f - db.dmp | grep "database dump complete" Although I guess if it's corrupted pg_restore won't work. It is really fast, but might not be practical if your database is too big.
- 411111111111111 4y agoMy issue was indeed the mishmash of versions, as the restore succeeded with the mentioned steps (installing old version, restoring, upgrading). nonetheless, interesting way to validate a backup, though it would probably take too long on most dumps