Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions spec/pg/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading