{"Entry":{"collection":"guc","key":"operator_precedence_warning","name":"operator_precedence_warning","aliases":[],"metadata":{"baseline":false,"boot_human":"off","boot_val":"off","category":"Version and Platform Compatibility / Previous PostgreSQL Versions","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"9.4","status":"added","to":"9.5"},{"documentation_changed":false,"fields":{},"from":"13","status":"removed","to":"14"}],"content_hash":"668f776409d0b30c608ef37ab9aa34b5493e9e008a968f64bb0036d1427be2a8","context":"user","default_changed_in":[],"default_history":[{"from":"9.5","to":"13","value":"off"}],"editorial":{"advice":{"olap":"Use the same migration path as OLTP, and also verify long batches, standbys, or large-object/extension workflows; removal of the old switch does not promise identical legacy behavior.","oltp":"Do not tune or continue emitting operator_precedence_warning on PG14+. PostgreSQL 14 removed the migration warning; rewrite ambiguous expressions with explicit parentheses and test them on the target release. Scan every configuration layer and regression-test the application before upgrade.","small":"Delete the obsolete setting and adopt the supported replacement directly; do not emulate legacy behavior in scripts without a demonstrated compatibility requirement."},"mechanism":["Emit a warning for constructs that changed meaning since PostgreSQL 9.4. The parameter still exists in PG13 and is no longer recognized from PG14. PostgreSQL 14 removed the migration warning; rewrite ambiguous expressions with explicit parentheses and test them on the target release.","This emitted migration warnings for expressions whose operator binding changed in PostgreSQL 9.5. It never restored old precedence, and after its removal the durable fix is explicit parentheses plus regression tests.","Before upgrading, inspect default_with_oids, lo_compat_privileges, synchronize_seqscans, remove the old name from configuration, ALTER SYSTEM, role/database settings, and automation templates, and verify the replacement before starting PG14 or later."],"pitfalls":["Continuing to emit unknown parameter operator_precedence_warning on PG14+.","Deleting only the setting name without migrating dependent application behavior.","Assuming the historical default equals the replacement mechanism's default.","Missing stale entries in ALTER SYSTEM, role/database settings, or automation templates."],"references":[{"title":"PostgreSQL 13: operator_precedence_warning","url":"https://www.postgresql.org/docs/13/runtime-config-compatible.html#GUC-OPERATOR-PRECEDENCE-WARNING"}],"related":["default_with_oids","lo_compat_privileges","synchronize_seqscans","standard_conforming_strings","array_nulls","backslash_quote"],"summary":"operator_precedence_warning — Emit a warning for constructs that changed meaning since PostgreSQL 9.4. Observed in PG9.5–13; its last measured boot default is off in PG13, with user context. It was removed in PG14."},"enumvals":[],"first_version":"9.5","group":"Version and Platform Compatibility","group_slug":"compatible","imported_at":"2026-09-27T17:57:31.803058+08:00","intro_commit":{"authored_at":"2015-03-11T13:22:52-04:00","discussion":[],"hash":"c6b3c939b7e0f1d35f4ed4996e71420a993810d2","subject":"Make operator precedence follow the SQL standard more closely.","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=c6b3c939b7e0f1d35f4ed4996e71420a993810d2"},"key":"operator_precedence_warning","last_version":"13","max_val":"","min_val":"","name":"operator_precedence_warning","position":304,"present_in":["9.5","9.6","10","11","12","13"],"short_desc":"When on, the parser will emit a warning for any construct that might have changed meanings since PostgreSQL 9.4 as a result of changes in operator precedence.","short_desc_zh":"","source_rev":"english-manuals:01b92cb70ef8e99fe793b2da7cd408092ebe9048fe5388a0f61a695b852c8d08","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"operator_precedence_warning","SourceDatabase":"center","Version":"13","SourceTable":"guc","SourceKey":"operator_precedence_warning","SourceRevision":"english-manuals:01b92cb70ef8e99fe793b2da7cd408092ebe9048fe5388a0f61a695b852c8d08","Facts":{"boot_val":"off","category":"Version and Platform Compatibility / Previous PostgreSQL Versions","context":"user","description":"When on, the parser will emit a warning for any construct that might have changed meanings since PostgreSQL 9.4 as a result of changes in operator precedence. This is useful for auditing applications to see if precedence changes have broken anything; but it is not meant to be kept turned on in production, since it will warn about some perfectly valid, standard-compliant SQL code. The default is off. See Section 4.1.6 for more information.","doc":{"anchor":"GUC-OPERATOR-PRECEDENCE-WARNING","file":"runtime-config-compatible.html","lang":"en","sha256":"c801ad003ab61a10c903ef5f3a7dcbb4688ee4d01fbbb6f33eb3484627b10ea7","slug":"13"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"13","min_val":null,"name":"operator_precedence_warning","short_desc":"Emit a warning for constructs that changed meaning since PostgreSQL 9.4.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-OPERATOR-PRECEDENCE-WARNING","file":"runtime-config-compatible.html","lang":"en","sha256":"c801ad003ab61a10c903ef5f3a7dcbb4688ee4d01fbbb6f33eb3484627b10ea7","slug":"13"}},"MeasuredEvidence":{"metadata_version":"13"}},"Text":{"Collection":"guc","Key":"operator_precedence_warning","SourceDatabase":"pgweb","Version":"13","Locale":"zh-Hans","Title":"operator_precedence_warning","Summary":"","BodyHTML":"\u003cp\u003e开启时，对于任何可能因操作符优先级的变化而在\u003cspan\u003ePostgreSQL\u003c/span\u003e 9.4 之后改变含义的构造，解析器都会发出警告。这有助于审查应用，检查优先级变化是否破坏了某些行为；但不应在生产环境中一直开启，因为它也会对一些完全有效、符合标准的 SQL 代码发出警告。默认值为\u003ccode\u003eoff\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e更多信息参见\u003ca href=\"/docs/13/sql-syntax.html#SQL-PRECEDENCE\" rel=\"nofollow\"\u003e第 4.1.6 节\u003c/a\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"8f9bee266147f86fc3d971352bd56bfbaf0b91e46567bc294ea16b6d386b8945","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e开启时，对于任何可能因操作符优先级的变化而在\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 9.4 之后改变含义的构造，解析器都会发出警告。这有助于审查应用，检查优先级变化是否破坏了某些行为；但不应在生产环境中一直开启，因为它也会对一些完全有效、符合标准的 SQL 代码发出警告。默认值为\u003ccode class=\"literal\"\u003eoff\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e更多信息参见\u003ca href=\"/docs/13/sql-syntax.html#SQL-PRECEDENCE\" title=\"4.1.6. 操作符优先级\"\u003e第 4.1.6 节\u003c/a\u003e。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
