[PATCH] Doc: document standard_conforming_strings dump/restore incompatibility

From: Baji Shaik <baji(dot)pgdev(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us
Subject: [PATCH] Doc: document standard_conforming_strings dump/restore incompatibility
Date: 2026-05-11 22:21:57
Message-ID: CA+fm-RM8bG0G6SJDaMgWkKmtyf4QG=V5We1ViAG0tZ5PU67rLQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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.

Dump files produced by older pg_dump versions from servers that had

standard_conforming_strings = off contain "SET standard_conforming_strings

= off" in the output. When restored into v19:

1/ Default (COPY format): pg_restore continues past the SET error and

data restores correctly, but exits with non-zero status. With

--exit-on-error, the restore aborts entirely.

2/ --inserts format: string literals containing backslashes may not be

restored correctly, since the escaping conventions differ between

standard_conforming_strings = off (source) and on (target).

The workaround is to restore into a pre-v19 server first, then produce

a fresh dump using v19 pg_dump (which forces scs=on in the source

session).

I verified this by dumping from PG18 with standard_conforming_strings =

off and restoring into PG19devel. The COPY case works because COPY has

its own escape rules independent of standard_conforming_strings. The

--inserts case results in double backslashes in the restored data.

The attached patch adds notes to:

- pg_dump reference page (Notes section)

- pg_restore reference page (Notes section)

- release-19 migration section

The patch applies cleanly on current HEAD and compiles without errors.

Discussion: https://postgr.es/m/3279216.1767072538@sss.pgh.pa.us

[1]
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=45762084545ec14dbbe66ace1d69d7e89f8978ac

Thanks,
Baji Shaik
AWS RDS

Attachment Content-Type Size
v1-0001-Doc-standard_conforming_strings-dump-restore-incompatibility.patch application/octet-stream 4.6 KB

Browse pgsql-hackers by date

  From Date Subject
Previous Message Bruce Momjian 2026-05-11 21:42:34 Re: First draft of PG 19 release notes