From 36293bb2b2449256ef5a4ba874cc786bcf1b699a Mon Sep 17 00:00:00 2001 From: Baji Shaik Date: Mon, 11 May 2026 07:59:32 -0500 Subject: [PATCH] Doc: document standard_conforming_strings dump/restore incompatibility Commit 45762084 forced standard_conforming_strings to always be ON starting in PostgreSQL 19. This means dump files produced by older pg_dump versions from servers that had standard_conforming_strings set to off will produce errors when restored into v19 or later. While COPY-format dumps restore data correctly despite the SET error, dumps produced with --inserts may have incorrectly escaped string literals, resulting in incorrect data being restored. Add notes to the pg_dump and pg_restore reference pages, and to the release-19 migration section, documenting this incompatibility and the workaround (restore into a pre-v19 server first, then re-dump). Discussion: https://postgr.es/m/3279216.1767072538@sss.pgh.pa.us --- doc/src/sgml/ref/pg_dump.sgml | 16 ++++++++++++++++ doc/src/sgml/ref/pg_restore.sgml | 17 +++++++++++++++++ doc/src/sgml/release-19.sgml | 1 + 3 files changed, 34 insertions(+) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index ae1bc14..3d2581a 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1732,6 +1732,22 @@ CREATE DATABASE foo WITH TEMPLATE template0; reserved-word lists in different PostgreSQL versions. + + Beginning in PostgreSQL 19, + standard_conforming_strings is always + on and cannot be set to off. + When dumping from older servers that have + standard_conforming_strings set to + off, a version 19 or later + pg_dump will force the setting to + on during the dump session, ensuring that the + output is compatible with version 19 and later. However, dump files + previously produced by older versions of pg_dump + while standard_conforming_strings was + off may not restore cleanly into version 19 or later; + see the documentation for details. + + When dumping logical replication subscriptions, pg_dump will generate CREATE diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index 5e77ddd..d419866 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -1200,6 +1200,23 @@ CREATE DATABASE foo WITH TEMPLATE template0; + + Dump files produced by pg_dump from servers + that had standard_conforming_strings set to + off contain + SET standard_conforming_strings = off, which will + produce an error when restored into PostgreSQL + 19 or later. By default, pg_restore will + continue past this error and restore data correctly when using + COPY format, but will exit with a non-zero status. + If is specified, the restore will abort. + Dumps produced with may have incorrectly + escaped string literals, resulting in incorrect data being restored. + To safely restore such dump files, first restore into a server running + a version prior to 19, then produce a fresh dump using a version 19 or + later pg_dump. + + The limitations of pg_restore are detailed below. diff --git a/doc/src/sgml/release-19.sgml b/doc/src/sgml/release-19.sgml index f265ac0..c769672 100644 --- a/doc/src/sgml/release-19.sgml +++ b/doc/src/sgml/release-19.sgml @@ -110,6 +110,7 @@ Force standard_conforming_strings to always be "on" in the database server (Tom Server variable escape_string_warning has been removed as unnecessary. Client applications still support "standard_conforming_strings = off" for compatibility with old servers. +Dump files previously produced with standard_conforming_strings set to off may not restore correctly into version 19; in particular, dumps made with may have incorrectly escaped string literals. To restore such files, first load them into a pre-version-19 server and then produce a fresh dump. -- 2.50.1 (Apple Git-155)