Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc02e52d

Browse files
committed
Don't let transform_null_equals=on affect CASE foo WHEN NULL ... constructs.
transform_null_equals is only supposed to affect "foo = NULL" expressionsgiven directly by the user, not the internal "foo = NULL" expressiongenerated from CASE-WHEN.This fixes bug #6242, reported by Sergey. Backpatch to all supportedbranches.
1 parentb77b601 commitc02e52d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/backend/parser/parse_expr.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,12 +830,15 @@ transformAExprOp(ParseState *pstate, A_Expr *a)
830830
/*
831831
* Special-case "foo = NULL" and "NULL = foo" for compatibility with
832832
* standards-broken products (like Microsoft's). Turn these into IS NULL
833-
* exprs.
833+
* exprs. (If either side is a CaseTestExpr, then the expression was
834+
* generated internally from a CASE-WHEN expression, and
835+
* transform_null_equals does not apply.)
834836
*/
835837
if (Transform_null_equals&&
836838
list_length(a->name)==1&&
837839
strcmp(strVal(linitial(a->name)),"=")==0&&
838-
(exprIsNullConstant(lexpr)||exprIsNullConstant(rexpr)))
840+
(exprIsNullConstant(lexpr)||exprIsNullConstant(rexpr))&&
841+
(!IsA(lexpr,CaseTestExpr)&& !IsA(rexpr,CaseTestExpr)))
839842
{
840843
NullTest*n=makeNode(NullTest);
841844

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp