{"Entry":{"collection":"guc","key":"standard_conforming_strings","name":"standard_conforming_strings","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Version and Platform Compatibility / Previous PostgreSQL Versions","category_zh":"","changed_in":["9.1","19"],"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":"8.2","status":"changed","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{"boot_val":{"from":"off","to":"on"}},"from":"9.0","status":"changed","to":"9.1"},{"documentation_changed":true,"fields":{"short_desc":{"from":"Causes '...' strings to treat backslashes literally.","to":"Nonstandard strings are no longer supported; this can only be true."}},"from":"18","status":"changed","to":"19"}],"content_hash":"a7672c28a8d474dc34f369b2473c6591c44b3787ed4a286a14694ce099682c3a","context":"","default_changed_in":["9.1"],"default_history":[{"from":"9.0","to":"9.0","value":"off"},{"from":"9.1","to":"19","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 standard_conforming_strings. 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":["Causes '...' strings to treat backslashes literally. It can be changed at session scope, so different sessions may observe different behavior.","With on, backslashes in ordinary '...' strings are literal and escape processing requires E'...'. Turning it off restores legacy parsing, making client/server disagreement and unsafe SQL construction more likely.","Monitor and change standard_conforming_strings together with array_nulls, backslash_quote, escape_string_warning. 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 19 Beta 4: standard_conforming_strings","url":"https://www.postgresql.org/docs/19/runtime-config-compatible.html#GUC-STANDARD-CONFORMING-STRINGS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["array_nulls","backslash_quote","escape_string_warning","transform_null_equals","quote_all_identifiers","default_with_oids"],"summary":"standard_conforming_strings — Nonstandard strings are no longer supported; this can only be true. Observed in PG9.0–19 Beta 4; its last measured boot default is on in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.1","group":"Version and Platform Compatibility","group_slug":"compatible","imported_at":"2026-09-27T17:57:32.054299+08:00","intro_commit":{},"key":"standard_conforming_strings","last_version":"20","max_val":"","min_val":"","name":"standard_conforming_strings","position":384,"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","19","20"],"short_desc":"This controls whether ordinary string literals ('...') treat backslashes literally, as specified in the SQL standard.","short_desc_zh":"","source_rev":"english-manuals:22366c51e754ede283d74c048b00598b09aecaf8cca4d11988d675aa13dbe142","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"standard_conforming_strings","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"standard_conforming_strings","SourceRevision":"english-manuals:22366c51e754ede283d74c048b00598b09aecaf8cca4d11988d675aa13dbe142","Facts":{"boot_val":"on","category":"Version and Platform Compatibility / Previous PostgreSQL Versions","context":"user","description":"This controls whether ordinary string literals ('...') treat backslashes literally, as specified in the SQL standard. Beginning in PostgreSQL 9.1, the default is on (prior releases defaulted to off). Applications can check this parameter to determine how string literals will be processed. The presence of this parameter can also be taken as an indication that the escape string syntax (E'...') is supported. Escape string syntax (Section 4.1.2.2) should be used if an application desires backslashes to be treated as escape characters.","doc":{"anchor":"GUC-STANDARD-CONFORMING-STRINGS","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":"standard_conforming_strings","short_desc":"Causes '...' strings to treat backslashes literally.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-STANDARD-CONFORMING-STRINGS","file":"runtime-config-compatible.html","lang":"en","sha256":"db2ecac1e62738d66a4932f4c8197976a349bcbf261c5b90fff740bc44867b8b","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"standard_conforming_strings","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"standard_conforming_strings","Summary":"","BodyHTML":"\u003cp\u003e控制普通字符串字面量（\u003ccode\u003e\u0026#39;...\u0026#39;\u003c/code\u003e）是否按照 SQL 标准把反斜线当普通文本。从\u003cspan\u003ePostgreSQL\u003c/span\u003e 9.1 开始，默认值为\u003ccode\u003eon\u003c/code\u003e（之前的发行中默认值为\u003ccode\u003eoff\u003c/code\u003e）。应用可以检查这个参数来判断字符串字面量如何被处理。这个参数的存在也可以被当做转义字符串语法（\u003ccode\u003eE\u0026#39;...\u0026#39;\u003c/code\u003e）被支持的标志。如果一个应用希望反斜线被当做转义字符，应该使用转义字符串语法（\u003ca href=\"/docs/18/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE\" rel=\"nofollow\"\u003e第 4.1.2.2 节\u003c/a\u003e）。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"f1535531dbae7a0c9635541909a135ede624949b8c04c37f6c75fdd6cc04495b","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e控制普通字符串字面量（\u003ccode class=\"literal\"\u003e'...'\u003c/code\u003e）是否按照 SQL 标准把反斜线当普通文本。从\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.1 开始，默认值为\u003ccode class=\"literal\"\u003eon\u003c/code\u003e（之前的发行中默认值为\u003ccode class=\"literal\"\u003eoff\u003c/code\u003e）。应用可以检查这个参数来判断字符串字面量如何被处理。这个参数的存在也可以被当做转义字符串语法（\u003ccode class=\"literal\"\u003eE'...'\u003c/code\u003e）被支持的标志。如果一个应用希望反斜线被当做转义字符，应该使用转义字符串语法（\u003ca href=\"/docs/18/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE\" title=\"4.1.2.2. C风格转义的字符串常量\"\u003e第 4.1.2.2 节\u003c/a\u003e）。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","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}
