|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.251 2007/11/15 21:14:36 momjian Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.252 2007/11/22 19:09:23 tgl Exp $ |
12 | 12 | * |
13 | 13 | * HISTORY |
14 | 14 | * AUTHORDATEMAJOR EVENT |
@@ -715,23 +715,26 @@ contain_mutable_functions_walker(Node *node, void *context) |
715 | 715 | { |
716 | 716 | OpExpr*expr= (OpExpr*)node; |
717 | 717 |
|
718 | | -if (op_volatile(expr->opno)!=PROVOLATILE_IMMUTABLE) |
| 718 | +set_opfuncid(expr); |
| 719 | +if (func_volatile(expr->opfuncid)!=PROVOLATILE_IMMUTABLE) |
719 | 720 | return true; |
720 | 721 | /* else fall through to check args */ |
721 | 722 | } |
722 | 723 | elseif (IsA(node,DistinctExpr)) |
723 | 724 | { |
724 | 725 | DistinctExpr*expr= (DistinctExpr*)node; |
725 | 726 |
|
726 | | -if (op_volatile(expr->opno)!=PROVOLATILE_IMMUTABLE) |
| 727 | +set_opfuncid((OpExpr*)expr);/* rely on struct equivalence */ |
| 728 | +if (func_volatile(expr->opfuncid)!=PROVOLATILE_IMMUTABLE) |
727 | 729 | return true; |
728 | 730 | /* else fall through to check args */ |
729 | 731 | } |
730 | 732 | elseif (IsA(node,ScalarArrayOpExpr)) |
731 | 733 | { |
732 | 734 | ScalarArrayOpExpr*expr= (ScalarArrayOpExpr*)node; |
733 | 735 |
|
734 | | -if (op_volatile(expr->opno)!=PROVOLATILE_IMMUTABLE) |
| 736 | +set_sa_opfuncid(expr); |
| 737 | +if (func_volatile(expr->opfuncid)!=PROVOLATILE_IMMUTABLE) |
735 | 738 | return true; |
736 | 739 | /* else fall through to check args */ |
737 | 740 | } |
@@ -767,7 +770,8 @@ contain_mutable_functions_walker(Node *node, void *context) |
767 | 770 | { |
768 | 771 | NullIfExpr*expr= (NullIfExpr*)node; |
769 | 772 |
|
770 | | -if (op_volatile(expr->opno)!=PROVOLATILE_IMMUTABLE) |
| 773 | +set_opfuncid((OpExpr*)expr);/* rely on struct equivalence */ |
| 774 | +if (func_volatile(expr->opfuncid)!=PROVOLATILE_IMMUTABLE) |
771 | 775 | return true; |
772 | 776 | /* else fall through to check args */ |
773 | 777 | } |
@@ -826,23 +830,26 @@ contain_volatile_functions_walker(Node *node, void *context) |
826 | 830 | { |
827 | 831 | OpExpr*expr= (OpExpr*)node; |
828 | 832 |
|
829 | | -if (op_volatile(expr->opno)==PROVOLATILE_VOLATILE) |
| 833 | +set_opfuncid(expr); |
| 834 | +if (func_volatile(expr->opfuncid)==PROVOLATILE_VOLATILE) |
830 | 835 | return true; |
831 | 836 | /* else fall through to check args */ |
832 | 837 | } |
833 | 838 | elseif (IsA(node,DistinctExpr)) |
834 | 839 | { |
835 | 840 | DistinctExpr*expr= (DistinctExpr*)node; |
836 | 841 |
|
837 | | -if (op_volatile(expr->opno)==PROVOLATILE_VOLATILE) |
| 842 | +set_opfuncid((OpExpr*)expr);/* rely on struct equivalence */ |
| 843 | +if (func_volatile(expr->opfuncid)==PROVOLATILE_VOLATILE) |
838 | 844 | return true; |
839 | 845 | /* else fall through to check args */ |
840 | 846 | } |
841 | 847 | elseif (IsA(node,ScalarArrayOpExpr)) |
842 | 848 | { |
843 | 849 | ScalarArrayOpExpr*expr= (ScalarArrayOpExpr*)node; |
844 | 850 |
|
845 | | -if (op_volatile(expr->opno)==PROVOLATILE_VOLATILE) |
| 851 | +set_sa_opfuncid(expr); |
| 852 | +if (func_volatile(expr->opfuncid)==PROVOLATILE_VOLATILE) |
846 | 853 | return true; |
847 | 854 | /* else fall through to check args */ |
848 | 855 | } |
@@ -878,7 +885,8 @@ contain_volatile_functions_walker(Node *node, void *context) |
878 | 885 | { |
879 | 886 | NullIfExpr*expr= (NullIfExpr*)node; |
880 | 887 |
|
881 | | -if (op_volatile(expr->opno)==PROVOLATILE_VOLATILE) |
| 888 | +set_opfuncid((OpExpr*)expr);/* rely on struct equivalence */ |
| 889 | +if (func_volatile(expr->opfuncid)==PROVOLATILE_VOLATILE) |
882 | 890 | return true; |
883 | 891 | /* else fall through to check args */ |
884 | 892 | } |
@@ -951,7 +959,8 @@ contain_nonstrict_functions_walker(Node *node, void *context) |
951 | 959 | { |
952 | 960 | OpExpr*expr= (OpExpr*)node; |
953 | 961 |
|
954 | | -if (!op_strict(expr->opno)) |
| 962 | +set_opfuncid(expr); |
| 963 | +if (!func_strict(expr->opfuncid)) |
955 | 964 | return true; |
956 | 965 | /* else fall through to check args */ |
957 | 966 | } |
@@ -1091,7 +1100,8 @@ find_nonnullable_rels_walker(Node *node, bool top_level) |
1091 | 1100 | { |
1092 | 1101 | OpExpr*expr= (OpExpr*)node; |
1093 | 1102 |
|
1094 | | -if (op_strict(expr->opno)) |
| 1103 | +set_opfuncid(expr); |
| 1104 | +if (func_strict(expr->opfuncid)) |
1095 | 1105 | result=find_nonnullable_rels_walker((Node*)expr->args, false); |
1096 | 1106 | } |
1097 | 1107 | elseif (IsA(node,ScalarArrayOpExpr)) |
@@ -1228,7 +1238,8 @@ is_strict_saop(ScalarArrayOpExpr *expr, bool falseOK) |
1228 | 1238 | Node*rightop; |
1229 | 1239 |
|
1230 | 1240 | /* The contained operator must be strict. */ |
1231 | | -if (!op_strict(expr->opno)) |
| 1241 | +set_sa_opfuncid(expr); |
| 1242 | +if (!func_strict(expr->opfuncid)) |
1232 | 1243 | return false; |
1233 | 1244 | /* If ANY and falseOK, that's all we need to check. */ |
1234 | 1245 | if (expr->useOr&&falseOK) |
|