{"Entry":{"collection":"guc","key":"escape_string_warning","name":"escape_string_warning","aliases":[],"metadata":{"baseline":false,"boot_human":"on","boot_val":"on","category":"Version and Platform Compatibility / Previous PostgreSQL Versions","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"8.0","status":"added","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"9.0","status":"changed","to":"9.1"},{"documentation_changed":false,"fields":{},"from":"18","status":"removed","to":"19"}],"content_hash":"8842c0d74f90fb3b66b2a042b2013f9050bd71c26d9f7aa4b77056042c9b81ca","context":"user","default_changed_in":[],"default_history":[{"from":"9.0","to":"18","value":"on"}],"derived_content_hash":"f03d9d6bfdd2c3b90f11142e14c26304c83be3da67b1b21313d8ec07ddd2fd40","editorial":{"advice":{"olap":"Regression-test ETL, generated SQL, and old drivers, where parsing/quoting assumptions hide. Performance is rarely a reason to change this switch.","oltp":"Keep the modern default and repair legacy clients/SQL that depend on escape_string_warning. Test migration at session scope first; do not make a compatibility switch permanent cluster policy.","small":"Keep the default without a legacy requirement. If temporarily enabled, record owner, affected connections, and a removal date."},"mechanism":["Warn about backslash escapes in ordinary string literals. It can be changed at session scope, so different sessions may observe different behavior.","When standard_conforming_strings is off, this warns about backslashes in ordinary strings so applications can migrate to standard literals or explicit E'...' strings. It diagnoses legacy SQL; it does not change parsing by itself.","Monitor and change escape_string_warning together with array_nulls, backslash_quote, standard_conforming_strings. Validate on the relevant server role and real workload, then use its user context to choose session change, reload, or restart; a historical boot default is not the current effective value."],"pitfalls":["Keeping a compatibility switch permanently instead of fixing the client.","Testing in one session and deploying globally to unrelated applications.","Confusing parsing compatibility with data or security compatibility.","Forgetting to remove an override after the upgrade migration is complete."],"references":[{"title":"PostgreSQL 18: escape_string_warning","url":"https://www.postgresql.org/docs/18/runtime-config-compatible.html#GUC-ESCAPE-STRING-WARNING"}],"related":["array_nulls","backslash_quote","standard_conforming_strings","transform_null_equals","quote_all_identifiers","default_with_oids"],"summary":"escape_string_warning — Warn about backslash escapes in ordinary string literals. Observed in PG9.0–18; its last measured boot default is on in PG18, with user context. It was removed in PG19 Beta 4."},"enumvals":[],"first_version":"8.1","group":"Version and Platform Compatibility","group_slug":"compatible","imported_at":"2026-09-27T17:57:31.250755+08:00","intro_commit":{},"key":"escape_string_warning","last_version":"18","max_val":"","min_val":"","name":"escape_string_warning","position":138,"present_in":["8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18"],"repair_provenance":{"original_source_revision":"english-manuals:48c6386bc4db837c3901db7d7914233c07b96363e53904f0b09f60c9c1f9f5fa","receipt_sha256":"9dda3e852408bbbd6a9ef71925d9eaadfb98b09244aecb6d528666d51dcfc36c","repair":"wiki-repair-20261023"},"short_desc":"When on, a warning is issued if a backslash (\\) appears in an ordinary string literal ('...' syntax) and standard_conforming_strings is off.","short_desc_zh":"","source_rev":"wiki-repair-20261023:7f751bbfca94660315501f3fcf44c5c3be79bd32368687e50994fd66b6041180","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"escape_string_warning","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"escape_string_warning","SourceRevision":"wiki-repair-20261023:7f751bbfca94660315501f3fcf44c5c3be79bd32368687e50994fd66b6041180","Facts":{"boot_val":"on","category":"Version and Platform Compatibility / Previous PostgreSQL Versions","context":"user","description":"When on, a warning is issued if a backslash (\\) appears in an ordinary string literal ('...' syntax) and standard_conforming_strings is off. The default is on. Applications that wish to use backslash as escape should be modified to use escape string syntax (E'...'), because the default behavior of ordinary strings is now to treat backslash as an ordinary character, per SQL standard. This variable can be enabled to help locate code that needs to be changed.","description_zh":"打开时，如果在普通字符串字面量中（'...' 语法）出现了一个反斜线（\\）并且 standard_conforming_strings 为关闭，那么就会发出一个警告。默认值是 on。 希望使用反斜线作为转义符的应用应该被修改来使用转义字符串语法（E'...'），因为按照 SQL 标准，普通字符串现在默认将反斜线视作一个普通字符。这个变量可以被启用来帮助定位需要被更改的代码。","description_zh_html":"\u003cp\u003e\n        打开时，如果在普通字符串字面量中（\u003ccode class=\"literal\"\u003e'...'\u003c/code\u003e 语法）出现了一个反斜线（\u003ccode class=\"literal\"\u003e\\\u003c/code\u003e）并且 \u003ccode class=\"varname\"\u003estandard_conforming_strings\u003c/code\u003e 为关闭，那么就会发出一个警告。默认值是 \u003ccode class=\"literal\"\u003eon\u003c/code\u003e。\n       \u003c/p\u003e\u003cp\u003e\n        希望使用反斜线作为转义符的应用应该被修改来使用转义字符串语法（\u003ccode class=\"literal\"\u003eE'...'\u003c/code\u003e），因为按照 SQL 标准，普通字符串现在默认将反斜线视作一个普通字符。这个变量可以被启用来帮助定位需要被更改的代码。\n       \u003c/p\u003e","doc":{"anchor":"GUC-ESCAPE-STRING-WARNING","file":"runtime-config-compatible.html","lang":"en","sha256":"db2ecac1e62738d66a4932f4c8197976a349bcbf261c5b90fff740bc44867b8b","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"escape_string_warning","short_desc":"Warn about backslash escapes in ordinary string literals.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-compatible.html","sha256":"01995ca3dfa6387ea699463dba924add2367e9a7fc4b9b43c1610c233e5e014b"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"bool","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-ESCAPE-STRING-WARNING","file":"runtime-config-compatible.html","lang":"en","sha256":"db2ecac1e62738d66a4932f4c8197976a349bcbf261c5b90fff740bc44867b8b","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"escape_string_warning","SourceDatabase":"center","Version":"18","Locale":"en","Title":"escape_string_warning","Summary":"When on, a warning is issued if a backslash (\\) appears in an ordinary string literal ('...' syntax) and standard_conforming_strings is off. The default is on. Applications that wish to use backslash as escape should be modified to use escape string syntax (E'...'), because the default behavior of ordinary strings is now to treat backslash as an ordinary character, per SQL standard. This variable can be enabled to help locate code that needs to be changed.","BodyHTML":"\u003cp\u003eWhen on, a warning is issued if a backslash (\\) appears in an ordinary string literal (\u0026#39;...\u0026#39; syntax) and standard_conforming_strings is off. The default is on. Applications that wish to use backslash as escape should be modified to use escape string syntax (E\u0026#39;...\u0026#39;), because the default behavior of ordinary strings is now to treat backslash as an ordinary character, per SQL standard. This variable can be enabled to help locate code that needs to be changed.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:7f751bbfca94660315501f3fcf44c5c3be79bd32368687e50994fd66b6041180","ContentHash":"4ba2ca89c642e47b7be2a74ac2f4b095c8356f6f8bb8722cce976f92dbca3a33","Payload":{"description":"When on, a warning is issued if a backslash (\\) appears in an ordinary string literal ('...' syntax) and standard_conforming_strings is off. The default is on. Applications that wish to use backslash as escape should be modified to use escape string syntax (E'...'), because the default behavior of ordinary strings is now to treat backslash as an ordinary character, per SQL standard. This variable can be enabled to help locate code that needs to be changed."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
