{"Entry":{"collection":"guc","key":"transform_null_equals","name":"transform_null_equals","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Version and Platform Compatibility / Other Platforms and Clients","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"}],"content_hash":"da62c01855e9588c1b243dce9fc7e176ed09b037c87d7bdca726b9a6ca98f670","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"off"}],"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 transform_null_equals. 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":["Treats \"expr=NULL\" as \"expr IS NULL\". It can be changed at session scope, so different sessions may observe different behavior.","The parser rewrites expr = NULL to expr IS NULL for broken legacy clients. SQL's normal three-valued semantics make equality with NULL yield unknown, so enabling this can hide application defects and does not rewrite other NULL comparisons.","Monitor and change transform_null_equals 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: transform_null_equals","url":"https://www.postgresql.org/docs/19/runtime-config-compatible.html#GUC-TRANSFORM-NULL-EQUALS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["array_nulls","backslash_quote","escape_string_warning","standard_conforming_strings","quote_all_identifiers","allow_alter_system"],"summary":"transform_null_equals — Treats \"expr=NULL\" as \"expr IS NULL\". Observed in PG9.0–19 Beta 4; its last measured boot default is off in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"7.4","group":"Version and Platform Compatibility","group_slug":"compatible","imported_at":"2026-09-27T17:57:32.241574+08:00","intro_commit":{},"key":"transform_null_equals","last_version":"20","max_val":"","min_val":"","name":"transform_null_equals","position":438,"present_in":["7.4","8.0","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":"When on, expressions of the form expr = NULL (or NULL = expr) are treated as expr IS NULL, that is, they return true if expr evaluates to the null value, and false otherwise.","short_desc_zh":"","source_rev":"english-manuals:c3edfc2b1384d9bd61603a332cabbf998d1c56ca6cffae93036a8f386b6dee91","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"transform_null_equals","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"transform_null_equals","SourceRevision":"english-manuals:c3edfc2b1384d9bd61603a332cabbf998d1c56ca6cffae93036a8f386b6dee91","Facts":{"boot_val":"off","category":"Version and Platform Compatibility / Other Platforms and Clients","context":"user","description":"When on, expressions of the form expr = NULL (or NULL = expr) are treated as expr IS NULL, that is, they return true if expr evaluates to the null value, and false otherwise. The correct SQL-spec-compliant behavior of expr = NULL is to always return null (unknown). Therefore this parameter defaults to off. However, filtered forms in Microsoft Access generate queries that appear to use expr = NULL to test for null values, so if you use that interface to access the database you might want to turn this option on. Since expressions of the form expr = NULL always return the null value (using the SQL standard interpretation), they are not very useful and do not appear often in normal applications so this option does little harm in practice. But new users are frequently confused about the semantics of expressions involving null values, so this option is off by default. Note that this option only affects the exact form = NULL, not other comparison operators or other expressions that are computationally equivalent to some expression involving the equals operator (such as IN). Thus, this option is not a general fix for bad programming. Refer to Section 9.2 for related information.","doc":{"anchor":"GUC-TRANSFORM-NULL-EQUALS","file":"runtime-config-compatible.html","lang":"en","sha256":"db2ecac1e62738d66a4932f4c8197976a349bcbf261c5b90fff740bc44867b8b","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"When turned on, expressions of the form expr = NULL (or NULL = expr) are treated as expr IS NULL, that is, they return true if expr evaluates to the null value, and false otherwise. The correct behavior of expr = NULL is to always return null (unknown).","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"transform_null_equals","short_desc":"Treats \"expr=NULL\" as \"expr IS NULL\".","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-TRANSFORM-NULL-EQUALS","file":"runtime-config-compatible.html","lang":"en","sha256":"db2ecac1e62738d66a4932f4c8197976a349bcbf261c5b90fff740bc44867b8b","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"transform_null_equals","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"transform_null_equals","Summary":"","BodyHTML":"\u003cp\u003e当打开时，形如\u003ccode\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e（或\u003ccode\u003eNULL = \u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e）的表达式将被当做\u003ccode\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e IS NULL\u003c/code\u003e，也就是说，如果\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e计算结果为空值则返回真，否则返回假。正确的 SQL 标准兼容的\u003ccode\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e行为总是返回空值（未知）。因此这个参数默认为\u003ccode\u003eoff\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e不过，在\u003cspan\u003eMicrosoft Access\u003c/span\u003e里的过滤表单生成的查询似乎使用\u003ccode\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e来测试空值，因此，如果你使用这个接口访问数据库，你可能想把这个选项打开。因为\u003ccode\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e形式的表达式总是返回空值（使用 SQL 标准解释），它们不是非常有用并且在普通应用中也不常见，因此这个选项实际上没有什么危害。但是新用户常常对涉及空值的表达式语义感到困惑，因此这个选项默认为关闭。\u003c/p\u003e\u003cp\u003e请注意这个选项只影响\u003ccode\u003e= NULL\u003c/code\u003e形式，而不影响其它比较操作符或者与一些涉及等值操作符的表达式在计算上等效的其他表达式（例如\u003ccode\u003eIN\u003c/code\u003e）。因此，这个选项不能普遍修复错误的程序写法。\u003c/p\u003e\u003cp\u003e相关信息请见\u003ca href=\"/docs/18/functions-comparison.html\" rel=\"nofollow\"\u003e第 9.2 节\u003c/a\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"41c26e320e0b15581fa2000707df85cd09562e0bdfc4647ced0ded2974ea8f21","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e当打开时，形如\u003ccode class=\"literal\"\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e（或\u003ccode class=\"literal\"\u003eNULL = \u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e）的表达式将被当做\u003ccode class=\"literal\"\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e IS NULL\u003c/code\u003e，也就是说，如果\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e计算结果为空值则返回真，否则返回假。正确的 SQL 标准兼容的\u003ccode class=\"literal\"\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e行为总是返回空值（未知）。因此这个参数默认为\u003ccode class=\"literal\"\u003eoff\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e不过，在\u003cspan class=\"productname\"\u003eMicrosoft Access\u003c/span\u003e里的过滤表单生成的查询似乎使用\u003ccode class=\"literal\"\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e来测试空值，因此，如果你使用这个接口访问数据库，你可能想把这个选项打开。因为\u003ccode class=\"literal\"\u003e\u003cem\u003e\u003ccode\u003eexpr\u003c/code\u003e\u003c/em\u003e = NULL\u003c/code\u003e形式的表达式总是返回空值（使用 SQL 标准解释），它们不是非常有用并且在普通应用中也不常见，因此这个选项实际上没有什么危害。但是新用户常常对涉及空值的表达式语义感到困惑，因此这个选项默认为关闭。\u003c/p\u003e\u003cp\u003e请注意这个选项只影响\u003ccode class=\"literal\"\u003e= NULL\u003c/code\u003e形式，而不影响其它比较操作符或者与一些涉及等值操作符的表达式在计算上等效的其他表达式（例如\u003ccode class=\"literal\"\u003eIN\u003c/code\u003e）。因此，这个选项不能普遍修复错误的程序写法。\u003c/p\u003e\u003cp\u003e相关信息请见\u003ca href=\"/docs/18/functions-comparison.html\" title=\"9.2. 比较函数和操作符\"\u003e第 9.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","7.4","8.0","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}
