* check_functions_in_node - * apply checker() to each function OID contained in given expression node * * Returns true if the checker() function does; for nodes representing more * than one function call, returns true if the checker() function does so * for any of those functions. Returns false if node does not invoke any * SQL-visible function. Caller must not pass node == NULL. * * T
| 1777 | * thought about how to treat them. |
| 1778 | */ |
| 1779 | bool |
| 1780 | check_functions_in_node(Node *node, check_function_callback checker, |
| 1781 | void *context) |
| 1782 | { |
| 1783 | switch (nodeTag(node)) |
| 1784 | { |
| 1785 | case T_Aggref: |
| 1786 | { |
| 1787 | Aggref *expr = (Aggref *) node; |
| 1788 | |
| 1789 | if (checker(expr->aggfnoid, context)) |
| 1790 | return true; |
| 1791 | } |
| 1792 | break; |
| 1793 | case T_WindowFunc: |
| 1794 | { |
| 1795 | WindowFunc *expr = (WindowFunc *) node; |
| 1796 | |
| 1797 | if (checker(expr->winfnoid, context)) |
| 1798 | return true; |
| 1799 | } |
| 1800 | break; |
| 1801 | case T_FuncExpr: |
| 1802 | { |
| 1803 | FuncExpr *expr = (FuncExpr *) node; |
| 1804 | |
| 1805 | if (checker(expr->funcid, context)) |
| 1806 | return true; |
| 1807 | } |
| 1808 | break; |
| 1809 | case T_OpExpr: |
| 1810 | case T_DistinctExpr: /* struct-equivalent to OpExpr */ |
| 1811 | case T_NullIfExpr: /* struct-equivalent to OpExpr */ |
| 1812 | { |
| 1813 | OpExpr *expr = (OpExpr *) node; |
| 1814 | |
| 1815 | /* Set opfuncid if it wasn't set already */ |
| 1816 | set_opfuncid(expr); |
| 1817 | if (checker(expr->opfuncid, context)) |
| 1818 | return true; |
| 1819 | } |
| 1820 | break; |
| 1821 | case T_ScalarArrayOpExpr: |
| 1822 | { |
| 1823 | ScalarArrayOpExpr *expr = (ScalarArrayOpExpr *) node; |
| 1824 | |
| 1825 | set_sa_opfuncid(expr); |
| 1826 | if (checker(expr->opfuncid, context)) |
| 1827 | return true; |
| 1828 | } |
| 1829 | break; |
| 1830 | case T_CoerceViaIO: |
| 1831 | { |
| 1832 | CoerceViaIO *expr = (CoerceViaIO *) node; |
| 1833 | Oid iofunc; |
| 1834 | Oid typioparam; |
| 1835 | bool typisvarlena; |
| 1836 |
no test coverage detected