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 1v29jQ-000r3h-GS for pgsql-general@arkaria.postgresql.org; Fri, 26 Sep 2025 14:47:32 +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 1v29jO-002V62-Fg for pgsql-general@arkaria.postgresql.org; Fri, 26 Sep 2025 14:47:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v29jN-002V5t-W9 for pgsql-general@lists.postgresql.org; Fri, 26 Sep 2025 14:47:30 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v29jM-0002fk-0B for pgsql-general@postgresql.org; Fri, 26 Sep 2025 14:47:29 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-57d5ccd73dfso2251577e87.0 for ; Fri, 26 Sep 2025 07:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1758898046; x=1759502846; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=244E8LEKtdF862+GZ9pqoYRUvdaU2dvZlkW6z4PTnH8=; b=h+V7Y5sP/WPW0hZjL/LzLouzoNQUV2lujnj67x+v34QPfNwqt5Gssk457aJAowECl5 o5GRMWmo2BGxgRvYx1uknEpCqdqI4646BhOJ8xZmtRd017YE9Sh7PqXhFAN52g81lEk5 herdkyEDm+KUy/3Ge8aKafcXXonZYE72gx3zB2LBaBQIr0ZPZ0D3/sJZSOeMFTRBt4Ej Q6ZMSBrU6vcICBXCqomZneoSY8pwThDyN7vWbewT3Jr0MdHCMWSp6+XnRpmnV9yvlstY gXZ4wlJU/Z4EABjlK94Q3hvDMc0H9IHmtHrcqY+0duiN1fZxgYzkbmECieYquHEIxvCb wc8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758898046; x=1759502846; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=244E8LEKtdF862+GZ9pqoYRUvdaU2dvZlkW6z4PTnH8=; b=wMfr56BaVr0RtdjYbXrrvI6nyzGqNnrchji/KHloEeOzdmEtJL6KJMhlGuHZO2Clci lSJ5wesQKBUiKWGYv2Gob6nMRxIj/gSf6vZbHkJ4yKvEYkZOjbCR/jmH1YHAlBiCpciT gDwlYiXwGdJNAmNItrOHowrqdxyf/88SgSzcCHiH9xbcCYK0YJ51xlZ/vZgT08bv4t61 /WhRCvro33JxSZGyFiTgWgBUFJS/ox0uztAsLRnA+5hog3MqyPfWu7QNtyE/vLmwfIv/ Ub2tllNbpz38O45dPRW4rgIta0PPv7zWcjmfx04G8peqA7hRE3014KkvuHwSevYf5eGO if/A== X-Gm-Message-State: AOJu0YwnByP6+HkggD571Y4BJT+Ed/8HVNjj7MPij2XccfTeSb7zYWcx Dqv/8lWIhTIZ/xBolNNqAGaDoLM+Y+m/LdXFZ6DRfXDw4EQ+ktjE31tAWjZ5vu9/AVM0LyGM/wk 4esmoBsUyZbWRmIWTILDuSfi8R04+eSI= X-Gm-Gg: ASbGnctiiHGKPmYc9V/wiY1syeZDn4PR/O/EqCQxc27bPIYWL741ixDrh2jiGn8pZB8 dtgLW/98UGIoJzUsEuqtY4WFbUL1YLdrl3qjfpp6nAJH4EgY5jfL0pomCjO1qtjXMU4Is7A14+p YeQMl8fiEOmjSwLrCSJrNbqGNr+JOMsuDyJ0BnbdjNFTuX2qWgzpOuNbkgZOgkq8mMX9nuT34gR jEVhAsYhHKsC1A/NPAgOGRPZT9LXGsgztZoaA/InwFuiE3z X-Google-Smtp-Source: AGHT+IFq86ciz+mhWRLHbhaqiAPzqpalofxsVTQLJ+95u/Wa7A/nuet2ZSSjISZQNey1GJ9AsMGbUJn49lo4wYmpv2o= X-Received: by 2002:a05:6512:12d6:b0:57a:d20:d499 with SMTP id 2adb3069b0e04-582d37cb373mr2554282e87.51.1758898045452; Fri, 26 Sep 2025 07:47:25 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashish Mukherjee Date: Fri, 26 Sep 2025 20:17:12 +0530 X-Gm-Features: AS18NWDS8UgE2_hQhc592Bfum-TsXzg3HcrlbDRFSP3t5eyxQ2i6ikLByVtvCXc Message-ID: Subject: Re: Downgrade pgsql 17 to pgsql 12 question To: Laurenz Albe Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="0000000000003220a0063fb55ddf" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003220a0063fb55ddf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you, Laurenz. Yes, I say binary dump/restore would be faster because of the -j option. Well, I suppose there's no certainty of what might break without going through the whole process. On Fri, Sep 26, 2025 at 7:57=E2=80=AFPM Laurenz Albe wrote: > 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 between both > versions > > for our database. It should have been caught in testing but was not. > > > > The clean way seems to be text file dump and restore but this would be > too > > 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 > wondering > > 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 > errors > > during restore but the table gets restored fine. > > > > pg_restore: error: while PROCESSING TOC: > > error: pg_restore: error: pg_restore: from TOC entry 17168; 1259 > 58572315 TABLE pkgs s14 > > pg_restore: error: pg_restore: pg_restore: 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 > > pg_restore: error: pg_restore: from TOC entry 17168; 1259 58572315 TABL= E > pkgs s14 > > error: from TOC entry 17168; 1259 58572315 TABLE pkgs s14 > > pg_restore: warning: errors ignored on restore: 2 > > > > pkgs is the table and s14 is my database > > There should be more: the actual error messages. These will give you a > clue. > > Yours, > Laurenz Albe > --0000000000003220a0063fb55ddf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you, Laurenz.=C2=A0

Yes, I say bi= nary dump/restore would be faster because of the -j option.

<= /div>
Well, I suppose there's no certainty of what might break with= out going through the whole process.

On Fri, Sep= 26, 2025 at 7:57=E2=80=AFPM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
On Fri, 2025-09-26 at 17:48 +0530, A= shish Mukherjee wrote:
> I have a strange requirement to downgrade from pgsql 17 to pgsql 12. T= his is
> because we found in production certain incompatibilities=C2=A0between = both versions
> for our database. It should have been caught in testing but was not. >
> The clean way seems to be text file dump and restore but this would be= too
> huge and too slow for our database of 3T. If I use pg_dump v17 and the= n
> restore with pg_restore v 17 on a pgsql v12 database, is there any ris= k?

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 t= he
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 wond= ering
> 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= errors
> during restore but the table gets restored fine.
>
> pg_restore: error: while PROCESSING TOC:
> =C2=A0error: pg_restore: =C2=A0error: =C2=A0 pg_restore: =C2=A0from TO= C entry 17168; 1259 58572315 TABLE pkgs s14
> pg_restore: error: pg_restore: pg_restore: pg_restore: =C2=A0 from TOC= entry 17168; 1259 58572315 TABLE pkgs s14
> pg_restore: =C2=A0 error: pg_restore: from TOC entry 17168; 1259 58572= 315 TABLE pkgs s14
> pg_restore: error: pg_restore: from TOC entry 17168; 1259 58572315 TAB= LE pkgs s14
> error: from TOC entry 17168; 1259 58572315 TABLE pkgs s14
> pg_restore: warning: errors ignored on restore: 2
>
> pkgs is the table and s14 is my database

There should be more: the actual error messages.=C2=A0 These will give you = a clue.

Yours,
Laurenz Albe
--0000000000003220a0063fb55ddf--