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 1v29QB-000nXG-9Q for pgsql-general@arkaria.postgresql.org; Fri, 26 Sep 2025 14:27:39 +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 1v29Q9-002DqE-AR for pgsql-general@arkaria.postgresql.org; Fri, 26 Sep 2025 14:27:37 +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 1v29Q8-002Dq5-UE for pgsql-general@lists.postgresql.org; Fri, 26 Sep 2025 14:27:37 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v29Q7-000EjB-12 for pgsql-general@postgresql.org; Fri, 26 Sep 2025 14:27:37 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-46e430494ccso1914415e9.1 for ; Fri, 26 Sep 2025 07:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1758896854; x=1759501654; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=bM9r9uzR6am3UC5pnxmNuIuQy8toreWdUBXpzUlX7Eg=; b=CckD714GfkH+82j80RoL3sYmL7dtuPBNWcFrT9YfvpRxvQD3Mxs+xO6c12UL/c6qEH ziIlpGWFuc4Ko9uv1BZHZL5TB0Ugfzp2PfV/zvBMQhwdLnH3xS64R6ajpHKPVVnyTGM6 YVq8i0azY0q9yiKxePS8agxYizIGmEiVwMLrbaeaVtR6Bh8o8W1TzYEISpH7zFq6QAEM 2SlbcQDDGVr5Y8sH+S0A5WmsBiczwUKHLw7AKz5miqAyci6U7MkCm1Jbo1ZI6veVr8y8 9Trs+hUwPD1Ezb/4FQ65lvqD7fi4SxXpFYs+n5iTMHOVNPRUdBxsonHCqejluwcMJSwU vxNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758896854; x=1759501654; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bM9r9uzR6am3UC5pnxmNuIuQy8toreWdUBXpzUlX7Eg=; b=qLaCk7APGrrn6vo4AVuYZTkW6ZWz16lYyGIhsHoRH6cuFfFc4FBituFKg/4NJpB2Wq t8WRfLqpaKK5JNzDh7SaH45sYbiggivhgGGSloNdBEJQHHtpL0vy24ZO36C5fkGzs3wl ZwCENdwzet/Lza8r9B8+t8y65b/8oQnkCrr73Wtej+N/dyUqF7MI5lGkNflWOk5wBvWu nlJ7WPvoP6frahiVHHouLFWYLK2NMfVHXZaVmthxqUOBfjFUx15oQEiDa8lcWhEIkBHU RjduYmzif9hXbeQIJx21vvgERthr5+HZH24r7XUKX14FQYVQ0H+JjmXq+abJx/yJOPYJ FkpQ== X-Forwarded-Encrypted: i=1; AJvYcCXYm7IIkzYiWiUmcB6GmkbmCSu2inRX73jkxYLR4uWMG2ZJYVUDKqZeXDd3ZpM+TXTkndmru+r3x4Rz6b0g@postgresql.org X-Gm-Message-State: AOJu0Yy/mD3fC/wjT6Cae6CuIY9+7V793mznCwzr/V3QS26eQ0Tr3kTy a9iH27yB4I/UzCFCRgZek8M+PCHz5UNSX5ad+sXgA2XfSihKbT31x/Or0Ks6celoDwI= X-Gm-Gg: ASbGncsLT6x2Kde0Vq91pXknT5Kq7FuVmTmb8pekn0bRmt2r4X3IVkqAWSAGJOP13G1 5j+OL6xSHW8FY9q05LpgxEPug7xtQ6RG17xdIg0OKrOJBVUrfGp4aODdcq6+6jIEAFzDzi1YbNi IqkEFK2JcMFn0eDHBkM7hj/m+acQ+U+PTGJwzfn9jKGZ87fB1NguEt40caDI8e1yJgETiybuW8z n4o5+LEAOyHsG+ZjdA8WN4hjGRuBkbdxugnee7mErUdefrfOmArKJm3qlZfyJ2cRSGnlm4ef/kn +zZlu/peQe+SknL3AroyboAHxlVb19vp4wyVYYmaY4vsTqb6j6TvQC5N6oR6MZswl1YSZy4i9Bf FUc8twGS/I/WPkcsIE9SIPStafRLykuxqBdiUBZOMQjXKYbwao59P+Q== X-Google-Smtp-Source: AGHT+IHVBF8noBoZUDVHco1XeJe+iXMZWMpAJi4a1dRHpR0c5o6ip3dDR+9DeMvyRWAIRwZKMc6KEg== X-Received: by 2002:a05:600c:4f49:b0:468:7a5a:725 with SMTP id 5b1f17b1804b1-46e329d499fmr72693295e9.1.1758896854035; Fri, 26 Sep 2025 07:27:34 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:70:4f4f:9e1e:c3e6:ae67:c99f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-46e2ab6a514sm118643665e9.22.2025.09.26.07.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Sep 2025 07:27:33 -0700 (PDT) Message-ID: Subject: Re: Downgrade pgsql 17 to pgsql 12 question From: Laurenz Albe To: Ashish Mukherjee , pgsql-general@postgresql.org Date: Fri, 26 Sep 2025 16:27:33 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2 (3.56.2-2.fc42) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2025-09-26 at 17:48 +0530, Ashish Mukherjee wrote: > I have a strange requirement to downgrade from pgsql 17 to pgsql 12. This= is > because we found in production certain incompatibilities=C2=A0between bot= h versions > for our database. It should have been caught in testing but was not. >=20 > The clean way seems to be text file dump and restore but this would be to= o > huge and too slow for our database of 3T. If I use pg_dump v17 and then > restore with pg_restore v 17 on a pgsql v12 database, is there any risk? Yes, there is the risk that the restore will fail. Downgrading is not supported. That's why the best way to do it is a plain format dump: you can edit the dump file to manually fix any errors. I am surprised that you think that restoring a plain format dump would be significantly slower than restoring a different format (unless you are talking about parallel restore with -j). > I tried a small test with a bunch of tables and it worked, but am wonderi= ng > about the pitfalls. I am restoring from the directory format dump. Anything can happen... > When I do dump/restore like this for a test table, I get the following er= rors > during restore but the table gets restored fine. >=20 > pg_restore: error: while PROCESSING TOC: > =C2=A0error: pg_restore: =C2=A0error: =C2=A0 pg_restore: =C2=A0from TOC e= ntry 17168; 1259 58572315 TABLE pkgs s14 > pg_restore: error: pg_restore: pg_restore: pg_restore: =C2=A0 from TOC en= try 17168; 1259 58572315 TABLE pkgs s14 > pg_restore: =C2=A0 error: pg_restore: from TOC entry 17168; 1259 58572315= TABLE pkgs s14 > pg_restore: error: pg_restore: from TOC entry 17168; 1259 58572315 TABLE = pkgs s14 > error: from TOC entry 17168; 1259 58572315 TABLE pkgs s14 > pg_restore: warning: errors ignored on restore: 2 >=20 > pkgs is the table and s14 is my database There should be more: the actual error messages. These will give you a clu= e. Yours, Laurenz Albe