* strip_implicit_coercions: remove implicit coercions at top level of tree * * This doesn't modify or copy the input expression tree, just return a * pointer to a suitable place within it. * * Note: there isn't any useful thing we can do with a RowExpr here, so * just return it unchanged, even if it's marked as an implicit coercion. */
| 669 | * just return it unchanged, even if it's marked as an implicit coercion. |
| 670 | */ |
| 671 | Node * |
| 672 | strip_implicit_coercions(Node *node) |
| 673 | { |
| 674 | if (node == NULL) |
| 675 | return NULL; |
| 676 | if (IsA(node, FuncExpr)) |
| 677 | { |
| 678 | FuncExpr *f = (FuncExpr *) node; |
| 679 | |
| 680 | if (f->funcformat == COERCE_IMPLICIT_CAST) |
| 681 | return strip_implicit_coercions(linitial(f->args)); |
| 682 | } |
| 683 | else if (IsA(node, RelabelType)) |
| 684 | { |
| 685 | RelabelType *r = (RelabelType *) node; |
| 686 | |
| 687 | if (r->relabelformat == COERCE_IMPLICIT_CAST) |
| 688 | return strip_implicit_coercions((Node *) r->arg); |
| 689 | } |
| 690 | else if (IsA(node, CoerceViaIO)) |
| 691 | { |
| 692 | CoerceViaIO *c = (CoerceViaIO *) node; |
| 693 | |
| 694 | if (c->coerceformat == COERCE_IMPLICIT_CAST) |
| 695 | return strip_implicit_coercions((Node *) c->arg); |
| 696 | } |
| 697 | else if (IsA(node, ArrayCoerceExpr)) |
| 698 | { |
| 699 | ArrayCoerceExpr *c = (ArrayCoerceExpr *) node; |
| 700 | |
| 701 | if (c->coerceformat == COERCE_IMPLICIT_CAST) |
| 702 | return strip_implicit_coercions((Node *) c->arg); |
| 703 | } |
| 704 | else if (IsA(node, ConvertRowtypeExpr)) |
| 705 | { |
| 706 | ConvertRowtypeExpr *c = (ConvertRowtypeExpr *) node; |
| 707 | |
| 708 | if (c->convertformat == COERCE_IMPLICIT_CAST) |
| 709 | return strip_implicit_coercions((Node *) c->arg); |
| 710 | } |
| 711 | else if (IsA(node, CoerceToDomain)) |
| 712 | { |
| 713 | CoerceToDomain *c = (CoerceToDomain *) node; |
| 714 | |
| 715 | if (c->coercionformat == COERCE_IMPLICIT_CAST) |
| 716 | return strip_implicit_coercions((Node *) c->arg); |
| 717 | } |
| 718 | return node; |
| 719 | } |
| 720 | |
| 721 | /* |
| 722 | * expression_returns_set |
no outgoing calls
no test coverage detected