diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 40c8462d680..bf2faa6d9f2 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2738,6 +2738,25 @@ deparse_stat_expression(Node *node,
 	return deparse_expression(node, context, false, false);
 }
 
+static Node *
+strip_restrict_info_nodes(Node *node, void *context)
+{
+	if (node == NULL)
+		return NULL;
+
+	switch (nodeTag(node))
+	{
+		case T_RestrictInfo:
+			return (Node *) ((RestrictInfo *) node)->clause;
+
+		default:
+			break;
+	}
+
+	return expression_tree_mutator(node, strip_restrict_info_nodes,
+								   (void *) context);
+}
+
 /*
  * Show a qualifier expression (which is a List with implicit AND semantics)
  */
@@ -2752,6 +2771,10 @@ show_stat_qual(List *qual, int is_or,
 	if (qual == NIL)
 		return NULL;
 
+	/* remove all RestrictInfo nodes, which are not expected by deparsing */
+	qual = (List *) expression_tree_mutator((Node *) qual,
+											strip_restrict_info_nodes, NULL);
+
 	/* Convert AND list to explicit AND */
 	switch (is_or)
 	{
