@@ -447,36 +447,6 @@ contain_mutable_or_user_functions_checker(Oid func_id, void *context)
447
447
func_id >= FirstNormalObjectId );
448
448
}
449
449
450
- /*
451
- * Check if the node contains any disallowed object. Subroutine for
452
- * check_simple_rowfilter_expr_walker.
453
- *
454
- * If a disallowed object is found, *errdetail_msg is set to a (possibly
455
- * translated) message to use as errdetail. If none, *errdetail_msg is not
456
- * modified.
457
- */
458
- static void
459
- expr_allowed_in_node (Node * node , ParseState * pstate , char * * errdetail_msg )
460
- {
461
- if (IsA (node , List ))
462
- {
463
- /*
464
- * OK, we don't need to perform other expr checks for List nodes
465
- * because those are undefined for List.
466
- */
467
- return ;
468
- }
469
-
470
- if (exprType (node ) >= FirstNormalObjectId )
471
- * errdetail_msg = _ ("User-defined types are not allowed." );
472
- else if (check_functions_in_node (node , contain_mutable_or_user_functions_checker ,
473
- (void * ) pstate ))
474
- * errdetail_msg = _ ("User-defined or built-in mutable functions are not allowed." );
475
- else if (exprCollation (node ) >= FirstNormalObjectId ||
476
- exprInputCollation (node ) >= FirstNormalObjectId )
477
- * errdetail_msg = _ ("User-defined collations are not allowed." );
478
- }
479
-
480
450
/*
481
451
* The row filter walker checks if the row filter expression is a "simple
482
452
* expression".
@@ -586,12 +556,26 @@ check_simple_rowfilter_expr_walker(Node *node, ParseState *pstate)
586
556
}
587
557
588
558
/*
589
- * For all the supported nodes, check the types, functions, and collations
590
- * used in the nodes.
559
+ * For all the supported nodes, if we haven't already found a problem,
560
+ * check the types, functions, and collations used in it. We check List
561
+ * by walking through each element.
591
562
*/
592
- if (!errdetail_msg )
593
- expr_allowed_in_node (node , pstate , & errdetail_msg );
563
+ if (!errdetail_msg && !IsA (node , List ))
564
+ {
565
+ if (exprType (node ) >= FirstNormalObjectId )
566
+ errdetail_msg = _ ("User-defined types are not allowed." );
567
+ else if (check_functions_in_node (node , contain_mutable_or_user_functions_checker ,
568
+ (void * ) pstate ))
569
+ errdetail_msg = _ ("User-defined or built-in mutable functions are not allowed." );
570
+ else if (exprCollation (node ) >= FirstNormalObjectId ||
571
+ exprInputCollation (node ) >= FirstNormalObjectId )
572
+ errdetail_msg = _ ("User-defined collations are not allowed." );
573
+ }
594
574
575
+ /*
576
+ * If we found a problem in this node, throw error now. Otherwise keep
577
+ * going.
578
+ */
595
579
if (errdetail_msg )
596
580
ereport (ERROR ,
597
581
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
@@ -653,13 +637,15 @@ TransformPubWhereClauses(List *tables, const char *queryString,
653
637
errdetail ("WHERE clause cannot be used for a partitioned table when %s is false." ,
654
638
"publish_via_partition_root" )));
655
639
640
+ /*
641
+ * A fresh pstate is required so that we only have "this" table in its
642
+ * rangetable
643
+ */
656
644
pstate = make_parsestate (NULL );
657
645
pstate -> p_sourcetext = queryString ;
658
-
659
646
nsitem = addRangeTableEntryForRelation (pstate , pri -> relation ,
660
647
AccessShareLock , NULL ,
661
648
false, false);
662
-
663
649
addNSItemToQuery (pstate , nsitem , false, true, true);
664
650
665
651
whereclause = transformWhereClause (pstate ,
0 commit comments