Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u7fQN-003bE1-1J for pgsql-general@arkaria.postgresql.org; Wed, 23 Apr 2025 19:06:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u7fQK-009FaA-GS for pgsql-general@arkaria.postgresql.org; Wed, 23 Apr 2025 19:06:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u7fQK-009Fa2-5l for pgsql-general@lists.postgresql.org; Wed, 23 Apr 2025 19:06:20 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u7fQH-001eD5-2y for pgsql-general@lists.postgresql.org; Wed, 23 Apr 2025 19:06:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 53NJ6G8L1435168; Wed, 23 Apr 2025 15:06:16 -0400 From: Tom Lane To: Pawel Veselov cc: pgsql-general@lists.postgresql.org Subject: Re: Dump version issues In-reply-to: References: Comments: In-reply-to Pawel Veselov message dated "Wed, 23 Apr 2025 20:46:39 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1435166.1745435176.1@sss.pgh.pa.us> Date: Wed, 23 Apr 2025 15:06:16 -0400 Message-ID: <1435167.1745435176@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pawel Veselov writes: > Was trying to import a database from a cloud deployment, and ran into this. > Exported the database with: > * pg_dump (PostgreSQL) 12.20 (Ubuntu 12.20-0ubuntu0.20.04.1) > * RDS PostgreSQL 12.19 on x86_64-pc-linux-gnu, compiled by gcc (GCC) > 7.3.1 20180712 (Red Hat 7.3.1-12), 64-bit > This produced a dump file of version 1.16, at least according to 'file'. Better take another look at which pg_dump you used. Archive version 1.16 was introduced in PG v17, according to a quick look at the source code. pg_restore versions older than v17 are not going to understand it. > I'm not sure whether the server has any say in the version of the dump > file, I assume it doesn't. Nope, just pg_dump. > So, how come older software (according to versions) produces dump > files with a greater version > than the newer software can understand? Is this Ubuntu package > maintainers messing things up? You'd have to ask them. > Given a pg_dump, it would be nice if its "-V" output would say which > version of the dump it would produce, > and a pg_restore - what's the max (and min, if that's a thing) version > of the dump that it will accept. Hmm, maybe. The original thought was that the archive version would seldom be a limiting factor: it describes the file format but not the SQL inside the file, and that's often version-specific too. So in general we don't promise that pg_dump version N will produce output that you can use with pg_restore or server versions less than N, whether they share the same archive version or not. regards, tom lane