Subject: Re: [PATCH] Doc: document standard_conforming_strings dump/restore incompatibility

From: Nathan Bossart <[email-masked]>
Date: Wed, 17 Jun 2026 10:27:35 -0500

[RMT hat]

On Mon, May 11, 2026 at 05:21:57PM -0500, Baji Shaik wrote:
> Commit 45762084 [1] forced standard_conforming_strings to always be ON in
> PostgreSQL 19. The release notes mention this change, but neither the
> pg_dump/pg_restore reference pages nor the migration section note the
> implications for restoring older dump files.

There's an open item for this with Tom listed as the owner.  Tom, have you
had a chance to take a look at this?

-- 
nathan

---

From: Tom Lane <[email-masked]>
Date: Wed, 17 Jun 2026 11:36:23 -0400

> had a chance to take a look at this?

Oh, I didn't know this'd been assigned to me.  Will look.

			regards, tom lane

---

From: Tom Lane <[email-masked]>
Date: Wed, 17 Jun 2026 13:29:09 -0400

> implications for restoring older dump files.

Okay, that's an oversight in the release notes for sure.  I'm more
skeptical about putting such information into the application
reference pages though.  It seems of only transient interest, but
any text we put there is likely to survive for many years.

Independently of that...

> The attached patch adds notes to:
> - pg_dump reference page (Notes section)
> - pg_restore reference page (Notes section)
> - release-19 migration section

I don't like this patch, because it presents much too rosy a view of
whether you can get away with not re-taking the dump.  It's unsafe
even with COPY-format data, because string literals in views, table
default expressions and constraints, function definitions, etc are all
at hazard of being misinterpreted.  I think we should just say it
won't work correctly, full stop.

I'm inclined to do more or less the attached, which also fixes what
seems a thinko in the existing text: we should say that clients still
support standard_conforming_strings = off, not
escape_string_warning = off.

			regards, tom lane

diff --git a/doc/src/sgml/release-19.sgml b/doc/src/sgml/release-19.sgml
index 285bfa123f6..4943885cf01 100644
--- a/doc/src/sgml/release-19.sgml
+++ b/doc/src/sgml/release-19.sgml
@@ -109,7 +109,18 @@ Force <link linkend="guc-standard-conforming-strings"><varname>standard_conformi
 </para>
 
 <para>
-Server variable <varname>escape_string_warning</varname> has been removed as unnecessary.  Client applications still support <literal>escape_string_warning = off</literal> for compatibility with old servers.
+This carries some risk for upgrades: a dump file produced by
+pre-v19 <application>pg_dump</application> from a server that
+had <literal>standard_conforming_strings = off</literal>
+will not restore correctly into v19 or later.  Use
+v19 <application>pg_dump</application> to take the dump, or
+set <literal>standard_conforming_strings = on</literal>
+in the old server before dumping.
+Client applications still support operations with servers
+having <literal>standard_conforming_strings = off</literal>, for
+compatibility with old servers.
+Server variable <varname>escape_string_warning</varname> has been removed
+as unnecessary.
 </para>
 </listitem>

---

From: Baji Shaik <[email-masked]>
Date: Wed, 17 Jun 2026 14:55:01 -0500

> escape_string_warning = off.

Thanks Tom. Good point about views, defaults, and function bodies.
I was only thinking about the data rows. Your v2 looks good to me.

Thanks,
Baji Shaik.

---

From: Bruce Momjian <[email-masked]>
Date: Wed, 17 Jun 2026 19:34:41 -0400

> escape_string_warning = off.

I have applied a slightly modified version to master, attached.  The git
commit suggested this problem, but I didn't understand the impact at the
time I read it.

-- 
  Bruce Momjian  <[email-masked]>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Do not let urgent matters crowd out time for investment in the future.
diff --git a/doc/src/sgml/release-19.sgml b/doc/src/sgml/release-19.sgml
index 285bfa123f6..911a198e676 100644
--- a/doc/src/sgml/release-19.sgml
+++ b/doc/src/sgml/release-19.sgml
@@ -109,7 +109,14 @@ Force <link linkend="guc-standard-conforming-strings"><varname>standard_conformi
 </para>
 
 <para>
-Server variable <varname>escape_string_warning</varname> has been removed as unnecessary.  Client applications still support <literal>escape_string_warning = off</literal> for compatibility with old servers.
+Dumps created using pre-<productname>PostgreSQL</productname> 19 versions of <link linkend="app-pgdump"><application>pg_dump</application></link>
+or <link linkend="app-pg-dumpall"><application>pg_dumpall</application></link>, and using <literal>standard_conforming_strings = off</literal>,
+will not properly load into <productname>PostgreSQL</productname> 19 and later servers.  Users should create dumps using <productname>PostgreSQL</productname> 19
+or later versions of these applications, or use <literal>standard_conforming_strings = on</literal>.
+</para>
+
+<para>
+Client applications still support <literal>escape_string_warning = off</literal> for compatibility with old servers.  The server variable <varname>escape_string_warning</varname> has been removed as unnecessary.
 </para>
 </listitem>

---

From: Tom Lane <[email-masked]>
Date: Thu, 18 Jun 2026 11:34:46 -0400

> commit suggested this problem, but I didn't understand the impact at the

This didn't correct the point I complained of above: it still says

Client applications still support <literal>escape_string_warning = off</literal> for compatibility with old servers.

The notion of a client "supporting" escape_string_warning seems quite
meaningless.  I think this intended to say standard_conforming_strings =
off.

			regards, tom lane

---

From: Bruce Momjian <[email-masked]>
Date: Thu, 18 Jun 2026 12:20:15 -0400

> meaningless.  I think this intended to say standard_conforming_strings =

Ah, yes, I see my mistake now.  Attached patch applied using your wording.

  Do not let urgent matters crowd out time for investment in the future.
diff --git a/doc/src/sgml/release-19.sgml b/doc/src/sgml/release-19.sgml
index 7c73cba11b7..96a09d6cd6e 100644
--- a/doc/src/sgml/release-19.sgml
+++ b/doc/src/sgml/release-19.sgml
@@ -116,7 +116,7 @@ or later versions of these applications, or use <literal>standard_conforming_str
 </para>
 
 <para>
-Client applications still support <literal>escape_string_warning = off</literal> for compatibility with old servers.  The server variable <varname>escape_string_warning</varname> has been removed as unnecessary.
+Client applications still support operations with servers having <literal>standard_conforming_strings = off</literal>, for compatibility with old servers.  The server variable <varname>escape_string_warning</varname> has been removed as unnecessary.
 </para>
 </listitem>