{"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"}],"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"],"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":"english-manuals:48c6386bc4db837c3901db7d7914233c07b96363e53904f0b09f60c9c1f9f5fa","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"escape_string_warning","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"escape_string_warning","SourceRevision":"english-manuals:48c6386bc4db837c3901db7d7914233c07b96363e53904f0b09f60c9c1f9f5fa","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.","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","unit":null,"vartype":"bool"},"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":"english-manuals:48c6386bc4db837c3901db7d7914233c07b96363e53904f0b09f60c9c1f9f5fa","ContentHash":"00faec38b06a7cd7d8683d07a7e2b7d5343bf8f03e1bcd4ba3a00080c2ab775a","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":"zh-Hans","Fallback":true,"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"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
