You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2022/12/23 06:24:21 UTC

[shardingsphere] branch master updated: Fix update where cipher column is null not rewrite. (#23054)

This is an automated email from the ASF dual-hosted git repository.

sunnianjun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new b7456bf0f6e Fix update where cipher column is null not rewrite. (#23054)
b7456bf0f6e is described below

commit b7456bf0f6e5e1eee22ced3e17421f4db2a7c325
Author: Chuxin Chen <ch...@qq.com>
AuthorDate: Fri Dec 23 14:24:13 2022 +0800

    Fix update where cipher column is null not rewrite. (#23054)
---
 .../statement/impl/MySQLStatementSQLVisitor.java   |  5 +-
 .../impl/OpenGaussStatementSQLVisitor.java         | 53 +++++++++++++++-------
 .../statement/impl/OracleStatementSQLVisitor.java  |  4 +-
 .../impl/PostgreSQLStatementSQLVisitor.java        | 53 +++++++++++++++-------
 .../statement/impl/SQL92StatementSQLVisitor.java   |  4 +-
 .../impl/SQLServerStatementSQLVisitor.java         |  4 +-
 .../it/parser/src/main/resources/case/dml/call.xml |  4 +-
 .../main/resources/case/dml/select-expression.xml  |  8 ++--
 .../src/main/resources/case/dml/select-with.xml    |  4 +-
 .../parser/src/main/resources/case/dml/select.xml  |  4 +-
 .../case/query-with-cipher/dml/update/update.xml   |  7 ++-
 11 files changed, 99 insertions(+), 51 deletions(-)

diff --git a/sql-parser/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java b/sql-parser/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java
index 850064d70ae..dbab96ed44b 100644
--- a/sql-parser/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java
+++ b/sql-parser/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLStatementSQLVisitor.java
@@ -423,6 +423,7 @@ public abstract class MySQLStatementSQLVisitor extends MySQLStatementBaseVisitor
     @Override
     public final ASTNode visitBooleanPrimary(final BooleanPrimaryContext ctx) {
         if (null != ctx.IS()) {
+            // TODO optimize operatorToken
             String rightText = "";
             if (null != ctx.NOT()) {
                 rightText = rightText.concat(ctx.start.getInputStream().getText(new Interval(ctx.NOT().getSymbol().getStartIndex(),
@@ -438,9 +439,9 @@ public abstract class MySQLStatementSQLVisitor extends MySQLStatementBaseVisitor
             if (null != ctx.FALSE()) {
                 operatorToken = ctx.FALSE().getSymbol();
             }
-            int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 1 : operatorToken.getStartIndex();
+            int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 2 : operatorToken.getStartIndex();
             rightText = rightText.concat(ctx.start.getInputStream().getText(new Interval(startIndex, ctx.stop.getStopIndex())));
-            ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 1, ctx.stop.getStopIndex(), rightText);
+            ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex(), rightText);
             String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
             ExpressionSegment left = (ExpressionSegment) visit(ctx.booleanPrimary());
             String operator = "IS";
diff --git a/sql-parser/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java b/sql-parser/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java
index b62a16583de..4930fc81a3c 100644
--- a/sql-parser/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java
+++ b/sql-parser/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussStatementSQLVisitor.java
@@ -173,12 +173,15 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.Sim
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SubqueryTableSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtil;
 import org.apache.shardingsphere.sql.parser.sql.common.value.collection.CollectionValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.keyword.KeywordValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.LiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.BooleanLiteralValue;
+import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.NullLiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.NumberLiteralValue;
+import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.OtherLiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.StringLiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.parametermarker.ParameterMarkerValue;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussExecuteStatement;
@@ -315,6 +318,12 @@ public abstract class OpenGaussStatementSQLVisitor extends OpenGaussStatementBas
     }
     
     private Optional<String> findBinaryOperator(final AExprContext ctx) {
+        if (null != ctx.IS()) {
+            return Optional.of(ctx.IS().getText());
+        }
+        if (null != ctx.ISNULL()) {
+            return Optional.of("IS");
+        }
         if (1 == ctx.aExpr().size()) {
             return Optional.empty();
         }
@@ -354,6 +363,20 @@ public abstract class OpenGaussStatementSQLVisitor extends OpenGaussStatementBas
     }
     
     private BinaryOperationExpression createBinaryOperationSegment(final AExprContext ctx, final String operator) {
+        if ("IS".equalsIgnoreCase(operator)) {
+            ExpressionSegment left = (ExpressionSegment) visit(ctx.aExpr(0));
+            String rightText;
+            ExpressionSegment right;
+            if (null != ctx.IS()) {
+                rightText = ctx.start.getInputStream().getText(new Interval(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex())).trim();
+                right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex(), rightText);
+            } else {
+                rightText = ctx.start.getInputStream().getText(new Interval(ctx.ISNULL().getSymbol().getStartIndex() + 2, ctx.stop.getStopIndex())).trim();
+                right = new LiteralExpressionSegment(ctx.ISNULL().getSymbol().getStartIndex() + 2, ctx.stop.getStopIndex(), rightText);
+            }
+            return new BinaryOperationExpression(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), left, right, "IS",
+                    ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex())));
+        }
         ExpressionSegment left = (ExpressionSegment) visit(ctx.aExpr(0));
         ExpressionSegment right = (ExpressionSegment) visit(ctx.aExpr(1));
         String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
@@ -372,11 +395,7 @@ public abstract class OpenGaussStatementSQLVisitor extends OpenGaussStatementBas
             return result;
         }
         if (null != ctx.aexprConst()) {
-            ASTNode result = visit(ctx.aexprConst());
-            if (result instanceof StringLiteralValue || result instanceof BooleanLiteralValue || result instanceof NumberLiteralValue) {
-                return new LiteralExpressionSegment(ctx.aexprConst().start.getStartIndex(), ctx.aexprConst().stop.getStopIndex(), ((LiteralValue) result).getValue());
-            }
-            return result;
+            return visit(ctx.aexprConst());
         }
         if (null != ctx.aExpr()) {
             return visit(ctx.aExpr());
@@ -464,19 +483,21 @@ public abstract class OpenGaussStatementSQLVisitor extends OpenGaussStatementBas
     
     @Override
     public ASTNode visitAexprConst(final AexprConstContext ctx) {
+        LiteralValue<?> value;
         if (null != ctx.numberConst()) {
-            return new NumberLiteralValue(ctx.numberConst().getText());
-        }
-        if (null != ctx.STRING_()) {
-            return new StringLiteralValue(ctx.STRING_().getText());
-        }
-        if (null != ctx.FALSE()) {
-            return new BooleanLiteralValue(ctx.FALSE().getText());
-        }
-        if (null != ctx.TRUE()) {
-            return new BooleanLiteralValue(ctx.TRUE().getText());
+            value = new NumberLiteralValue(ctx.numberConst().getText());
+        } else if (null != ctx.STRING_()) {
+            value = new StringLiteralValue(ctx.STRING_().getText());
+        } else if (null != ctx.FALSE()) {
+            value = new BooleanLiteralValue(ctx.FALSE().getText());
+        } else if (null != ctx.TRUE()) {
+            value = new BooleanLiteralValue(ctx.TRUE().getText());
+        } else if (null != ctx.NULL()) {
+            value = new NullLiteralValue(ctx.getText());
+        } else {
+            value = new OtherLiteralValue(ctx.getText());
         }
-        return new CommonExpressionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ctx.getText());
+        return SQLUtil.createLiteralExpression(value, ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ctx.getText());
     }
     
     @Override
diff --git a/sql-parser/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleStatementSQLVisitor.java b/sql-parser/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleStatementSQLVisitor.java
index 14540f1d1d2..3c0f5273a2e 100644
--- a/sql-parser/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleStatementSQLVisitor.java
+++ b/sql-parser/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/impl/OracleStatementSQLVisitor.java
@@ -384,9 +384,9 @@ public abstract class OracleStatementSQLVisitor extends OracleStatementBaseVisit
         if (null != ctx.FALSE()) {
             operatorToken = ctx.FALSE().getSymbol();
         }
-        int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 1 : operatorToken.getStartIndex();
+        int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 2 : operatorToken.getStartIndex();
         rightText = rightText.concat(ctx.start.getInputStream().getText(new Interval(startIndex, ctx.stop.getStopIndex())));
-        ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 1, ctx.stop.getStopIndex(), rightText);
+        ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex(), rightText);
         String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
         ExpressionSegment left = (ExpressionSegment) visit(ctx.booleanPrimary());
         String operator = "IS";
diff --git a/sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java b/sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
index c6f9adf8d66..bd7d88aead9 100644
--- a/sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
+++ b/sql-parser/dialect/postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLStatementSQLVisitor.java
@@ -173,12 +173,15 @@ import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.Sim
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SubqueryTableSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtil;
 import org.apache.shardingsphere.sql.parser.sql.common.value.collection.CollectionValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.keyword.KeywordValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.LiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.BooleanLiteralValue;
+import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.NullLiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.NumberLiteralValue;
+import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.OtherLiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.literal.impl.StringLiteralValue;
 import org.apache.shardingsphere.sql.parser.sql.common.value.parametermarker.ParameterMarkerValue;
 import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.ddl.PostgreSQLExecuteStatement;
@@ -315,6 +318,12 @@ public abstract class PostgreSQLStatementSQLVisitor extends PostgreSQLStatementP
     }
     
     private Optional<String> findBinaryOperator(final AExprContext ctx) {
+        if (null != ctx.IS()) {
+            return Optional.of(ctx.IS().getText());
+        }
+        if (null != ctx.ISNULL()) {
+            return Optional.of("IS");
+        }
         if (1 == ctx.aExpr().size()) {
             return Optional.empty();
         }
@@ -354,6 +363,20 @@ public abstract class PostgreSQLStatementSQLVisitor extends PostgreSQLStatementP
     }
     
     private BinaryOperationExpression createBinaryOperationSegment(final AExprContext ctx, final String operator) {
+        if ("IS".equalsIgnoreCase(operator)) {
+            ExpressionSegment left = (ExpressionSegment) visit(ctx.aExpr(0));
+            String rightText;
+            ExpressionSegment right;
+            if (null != ctx.IS()) {
+                rightText = ctx.start.getInputStream().getText(new Interval(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex())).trim();
+                right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex(), rightText);
+            } else {
+                rightText = ctx.start.getInputStream().getText(new Interval(ctx.ISNULL().getSymbol().getStartIndex() + 2, ctx.stop.getStopIndex())).trim();
+                right = new LiteralExpressionSegment(ctx.ISNULL().getSymbol().getStartIndex() + 2, ctx.stop.getStopIndex(), rightText);
+            }
+            return new BinaryOperationExpression(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), left, right, "IS",
+                    ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex())));
+        }
         ExpressionSegment left = (ExpressionSegment) visit(ctx.aExpr(0));
         ExpressionSegment right = (ExpressionSegment) visit(ctx.aExpr(1));
         String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
@@ -372,11 +395,7 @@ public abstract class PostgreSQLStatementSQLVisitor extends PostgreSQLStatementP
             return result;
         }
         if (null != ctx.aexprConst()) {
-            ASTNode result = visit(ctx.aexprConst());
-            if (result instanceof StringLiteralValue || result instanceof BooleanLiteralValue || result instanceof NumberLiteralValue) {
-                return new LiteralExpressionSegment(ctx.aexprConst().start.getStartIndex(), ctx.aexprConst().stop.getStopIndex(), ((LiteralValue) result).getValue());
-            }
-            return result;
+            return visit(ctx.aexprConst());
         }
         if (null != ctx.aExpr()) {
             return visit(ctx.aExpr());
@@ -461,19 +480,21 @@ public abstract class PostgreSQLStatementSQLVisitor extends PostgreSQLStatementP
     
     @Override
     public ASTNode visitAexprConst(final AexprConstContext ctx) {
+        LiteralValue<?> value;
         if (null != ctx.numberConst()) {
-            return new NumberLiteralValue(ctx.numberConst().getText());
-        }
-        if (null != ctx.STRING_()) {
-            return new StringLiteralValue(ctx.STRING_().getText());
-        }
-        if (null != ctx.FALSE()) {
-            return new BooleanLiteralValue(ctx.FALSE().getText());
-        }
-        if (null != ctx.TRUE()) {
-            return new BooleanLiteralValue(ctx.TRUE().getText());
+            value = new NumberLiteralValue(ctx.numberConst().getText());
+        } else if (null != ctx.STRING_()) {
+            value = new StringLiteralValue(ctx.STRING_().getText());
+        } else if (null != ctx.FALSE()) {
+            value = new BooleanLiteralValue(ctx.FALSE().getText());
+        } else if (null != ctx.TRUE()) {
+            value = new BooleanLiteralValue(ctx.TRUE().getText());
+        } else if (null != ctx.NULL()) {
+            value = new NullLiteralValue(ctx.getText());
+        } else {
+            value = new OtherLiteralValue(ctx.getText());
         }
-        return new CommonExpressionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ctx.getText());
+        return SQLUtil.createLiteralExpression(value, ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ctx.getText());
     }
     
     @Override
diff --git a/sql-parser/dialect/sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/impl/SQL92StatementSQLVisitor.java b/sql-parser/dialect/sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/impl/SQL92StatementSQLVisitor.java
index af153683cee..d3d3907c8b7 100644
--- a/sql-parser/dialect/sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/impl/SQL92StatementSQLVisitor.java
+++ b/sql-parser/dialect/sql92/src/main/java/org/apache/shardingsphere/sql/parser/sql92/visitor/statement/impl/SQL92StatementSQLVisitor.java
@@ -276,9 +276,9 @@ public abstract class SQL92StatementSQLVisitor extends SQL92StatementBaseVisitor
             if (null != ctx.FALSE()) {
                 operatorToken = ctx.FALSE().getSymbol();
             }
-            int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 1 : operatorToken.getStartIndex();
+            int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 2 : operatorToken.getStartIndex();
             rightText = rightText.concat(ctx.start.getInputStream().getText(new Interval(startIndex, ctx.stop.getStopIndex())));
-            ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 1, ctx.stop.getStopIndex(), rightText);
+            ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex(), rightText);
             String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
             ExpressionSegment left = (ExpressionSegment) visit(ctx.booleanPrimary());
             String operator = "IS";
diff --git a/sql-parser/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java b/sql-parser/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java
index 454061fc1d7..aebbc7df729 100644
--- a/sql-parser/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java
+++ b/sql-parser/dialect/sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerStatementSQLVisitor.java
@@ -391,9 +391,9 @@ public abstract class SQLServerStatementSQLVisitor extends SQLServerStatementBas
             if (null != ctx.FALSE()) {
                 operatorToken = ctx.FALSE().getSymbol();
             }
-            int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 1 : operatorToken.getStartIndex();
+            int startIndex = null == operatorToken ? ctx.IS().getSymbol().getStopIndex() + 2 : operatorToken.getStartIndex();
             rightText = rightText.concat(ctx.start.getInputStream().getText(new Interval(startIndex, ctx.stop.getStopIndex())));
-            ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 1, ctx.stop.getStopIndex(), rightText);
+            ExpressionSegment right = new LiteralExpressionSegment(ctx.IS().getSymbol().getStopIndex() + 2, ctx.stop.getStopIndex(), rightText);
             String text = ctx.start.getInputStream().getText(new Interval(ctx.start.getStartIndex(), ctx.stop.getStopIndex()));
             ExpressionSegment left = (ExpressionSegment) visit(ctx.booleanPrimary());
             String operator = "IS";
diff --git a/test/it/parser/src/main/resources/case/dml/call.xml b/test/it/parser/src/main/resources/case/dml/call.xml
index 0b4dac9cc10..cec4e3986ad 100644
--- a/test/it/parser/src/main/resources/case/dml/call.xml
+++ b/test/it/parser/src/main/resources/case/dml/call.xml
@@ -94,7 +94,7 @@
     <call sql-case-id="call_with_mixed_notation">
         <procedure-name name="p" start-index="5" stop-index="6" />
         <procedure-parameter>
-            <common-expression literal-text="null" start-index="7" stop-index="10" />
+            <literal-expression value="null" start-index="7" stop-index="10" />
         </procedure-parameter>
         <procedure-parameter>
             <literal-expression value="7" start-index="13" stop-index="13" />
@@ -107,7 +107,7 @@
     <call sql-case-id="call_with_mixed_notation_with_null">
         <procedure-name name="p" start-index="5" stop-index="6" />
         <procedure-parameter>
-            <common-expression literal-text="null" start-index="7" stop-index="10" />
+            <literal-expression value="null" start-index="7" stop-index="10" />
         </procedure-parameter>
         <procedure-parameter>
             <common-expression literal-text="c => 4" start-index="13" stop-index="18" />
diff --git a/test/it/parser/src/main/resources/case/dml/select-expression.xml b/test/it/parser/src/main/resources/case/dml/select-expression.xml
index 96c742d2a7b..fafbb2f8396 100644
--- a/test/it/parser/src/main/resources/case/dml/select-expression.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-expression.xml
@@ -588,7 +588,7 @@
                     </left>
                     <operator>IS</operator>
                     <right>
-                        <literal-expression value="FALSE" start-index="51" stop-index="56" />
+                        <literal-expression value="FALSE" start-index="52" stop-index="56" />
                     </right>
                 </binary-operation-expression>
             </expr>
@@ -621,7 +621,7 @@
                     </left>
                     <operator>IS</operator>
                     <right>
-                        <literal-expression value="NOT FALSE" start-index="51" stop-index="60" />
+                        <literal-expression value="NOT FALSE" start-index="52" stop-index="60" />
                     </right>
                 </binary-operation-expression>
             </expr>
@@ -645,7 +645,7 @@
                     </left>
                     <operator>IS</operator>
                     <right>
-                        <literal-expression value="NULL" start-index="45" stop-index="49" />
+                        <literal-expression value="NULL" start-index="46" stop-index="49" />
                     </right>
                 </binary-operation-expression>
             </expr>
@@ -669,7 +669,7 @@
                     </left>
                     <operator>IS</operator>
                     <right>
-                        <literal-expression value="NOT NULL" start-index="45" stop-index="53" />
+                        <literal-expression value="NOT NULL" start-index="46" stop-index="53" />
                     </right>
                 </binary-operation-expression>
             </expr>
diff --git a/test/it/parser/src/main/resources/case/dml/select-with.xml b/test/it/parser/src/main/resources/case/dml/select-with.xml
index b428edd5fab..ad621772d83 100644
--- a/test/it/parser/src/main/resources/case/dml/select-with.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-with.xml
@@ -172,7 +172,7 @@
                                     </left>
                                     <operator>IS</operator>
                                     <right>
-                                        <literal-expression value="NULL" start-index="177" stop-index="181" />
+                                        <literal-expression value="NULL" start-index="178" stop-index="181" />
                                     </right>
                                 </binary-operation-expression>
                             </expr>
@@ -221,7 +221,7 @@
                                     </left>
                                     <operator>IS</operator>
                                     <right>
-                                        <literal-expression value="NULL" start-index="186" stop-index="190" />
+                                        <literal-expression value="NULL" start-index="187" stop-index="190" />
                                     </right>
                                 </binary-operation-expression>
                             </expr>
diff --git a/test/it/parser/src/main/resources/case/dml/select.xml b/test/it/parser/src/main/resources/case/dml/select.xml
index bf44016c31b..97129aff657 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -267,7 +267,7 @@
                             </left>
                             <operator>IS</operator>
                             <right>
-                                <literal-expression value="NOT NULL" start-index="43" stop-index="51" />
+                                <literal-expression value="NOT NULL" start-index="44" stop-index="51" />
                             </right>
                         </binary-operation-expression>
                         <common-expression text="item_id IS NOT NULL" start-index="33" stop-index="51" />
@@ -319,7 +319,7 @@
                             <operator>IS</operator>
                             <right>
                                 <!-- TODO: literal value should be 'NOT NULL' -->
-                                <literal-expression value="NOT NULL" start-index="43" stop-index="51" />
+                                <literal-expression value="NOT NULL" start-index="44" stop-index="51" />
                             </right>
                         </binary-operation-expression>
                         <common-expression text="item_id IS NOT NULL" start-index="33" stop-index="51" />
diff --git a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/update/update.xml b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/update/update.xml
index 1325497ece5..e35689ed434 100644
--- a/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/update/update.xml
+++ b/test/it/rewriter/src/test/resources/scenario/encrypt/case/query-with-cipher/dml/update/update.xml
@@ -74,11 +74,16 @@
         <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL, cipher_certificate_number = 'encrypt_', assisted_query_certificate_number = 'assisted_query_', like_query_certificate_number = 'like_query_', plain_certificate_number = ''" />
     </rewrite-assertion>
 
-    <rewrite-assertion id="update_null_to_clear_plain_where_is_null" db-types="MySQL">
+    <rewrite-assertion id="update_null_to_clear_plain_where_is_null" db-types="MySQL,PostgreSQL,openGauss">
         <input sql="UPDATE t_account_bak SET certificate_number = NULL WHERE certificate_number IS NULL" />
         <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL WHERE assisted_query_certificate_number IS NULL" />
     </rewrite-assertion>
 
+    <rewrite-assertion id="update_null_to_clear_plain_where_isnull" db-types="PostgreSQL,openGauss">
+        <input sql="UPDATE t_account_bak SET certificate_number = NULL WHERE certificate_number ISNULL" />
+        <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL WHERE assisted_query_certificate_number ISNULL" />
+    </rewrite-assertion>
+
     <rewrite-assertion id="update_null_to_clear_plain_where_is_null_with_multi" db-types="MySQL">
         <input sql="UPDATE t_account_bak SET certificate_number = NULL WHERE certificate_number IS NULL AND status = 'OK' AND certificate_number = '111X' AND certificate_number like '111X'" />
         <output sql="UPDATE t_account_bak SET cipher_certificate_number = NULL, assisted_query_certificate_number = NULL, like_query_certificate_number = NULL, plain_certificate_number = NULL WHERE assisted_query_certificate_number IS NULL AND status = 'OK' AND assisted_query_certificate_number = 'assisted_query_111X' AND like_query_certificate_number like 'like_query_111X'" />