From 7ff2b08b56cbb15a57406aab918602e9b58ca7cd Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Mon, 5 Oct 2026 16:36:14 +0900 Subject: [PATCH] Skip standard_conforming_strings=off specs on PostgreSQL-19 PostgreSQL-19 forces standard_conforming_strings to always be on and removes escape_string_warning, so the embed_params specs that switch these settings fail: SET standard_conforming_strings = off ERROR: non-standard string literals are not supported SET escape_string_warning = off ERROR: unrecognized configuration parameter "escape_string_warning" Skip the "off" variants on PostgreSQL-19 and run the "on" variants without changing the settings. https://www.postgresql.org/docs/19/release-19.html#RELEASE-19-MIGRATION https://github.com/postgres/postgres/commit/45762084545ec14dbbe66ace1d69d7e89f8978ac Co-Authored-By: Claude Opus 5.5 --- spec/pg/connection_spec.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/spec/pg/connection_spec.rb b/spec/pg/connection_spec.rb index 05e373e89..427bb07fe 100644 --- a/spec/pg/connection_spec.rb +++ b/spec/pg/connection_spec.rb @@ -3063,12 +3063,20 @@ def embed_params_and_check(sql, params, conn: @conn) end def with_std_conf_strings(conn, onoff) - conn.exec("SET standard_conforming_strings = #{onoff}") - conn.exec("SET escape_string_warning = #{onoff}") - yield - ensure - conn.exec("SET standard_conforming_strings = on") - conn.exec("SET escape_string_warning = on") + # PostgreSQL-19 rejects standard_conforming_strings=off and removed escape_string_warning + if conn.server_version >= 190000 + skip "standard_conforming_strings=off is not supported by the server" if onoff == "off" + return yield + end + + begin + conn.exec("SET standard_conforming_strings = #{onoff}") + conn.exec("SET escape_string_warning = #{onoff}") + yield + ensure + conn.exec("SET standard_conforming_strings = on") + conn.exec("SET escape_string_warning = on") + end end it "ensures PostgreSQL string syntax does not change" do