gram.c
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:504k
- case 644:
- #line 3558 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = yyvsp[-6].list;
- n->oper = lcons(yyvsp[-4].str, NIL);
- if (strcmp(yyvsp[-4].str,"<>") == 0)
- n->useor = true;
- else
- n->useor = false;
- n->subLinkType = yyvsp[-3].ival;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 645:
- #line 3571 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = yyvsp[-5].list;
- n->oper = lcons(yyvsp[-3].str, NIL);
- if (strcmp(yyvsp[-3].str,"<>") == 0)
- n->useor = true;
- else
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 646:
- #line 3584 "gram.y"
- {
- yyval.node = makeRowExpr(yyvsp[-3].str, yyvsp[-5].list, yyvsp[-1].list);
- ;
- break;}
- case 647:
- #line 3590 "gram.y"
- {
- yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node);
- ;
- break;}
- case 648:
- #line 3596 "gram.y"
- {
- yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node);
- ;
- break;}
- case 649:
- #line 3600 "gram.y"
- {
- yyval.list = lcons(yyvsp[0].node, NIL);
- ;
- break;}
- case 650:
- #line 3605 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 651:
- #line 3606 "gram.y"
- { yyval.str = "<"; ;
- break;}
- case 652:
- #line 3607 "gram.y"
- { yyval.str = "="; ;
- break;}
- case 653:
- #line 3608 "gram.y"
- { yyval.str = ">"; ;
- break;}
- case 654:
- #line 3609 "gram.y"
- { yyval.str = "+"; ;
- break;}
- case 655:
- #line 3610 "gram.y"
- { yyval.str = "-"; ;
- break;}
- case 656:
- #line 3611 "gram.y"
- { yyval.str = "*"; ;
- break;}
- case 657:
- #line 3612 "gram.y"
- { yyval.str = "/"; ;
- break;}
- case 658:
- #line 3613 "gram.y"
- { yyval.str = "%"; ;
- break;}
- case 659:
- #line 3616 "gram.y"
- { yyval.ival = ANY_SUBLINK; ;
- break;}
- case 660:
- #line 3617 "gram.y"
- { yyval.ival = ALL_SUBLINK; ;
- break;}
- case 661:
- #line 3629 "gram.y"
- {
- yyvsp[-1].attr->indirection = yyvsp[0].list;
- yyval.node = (Node *)yyvsp[-1].attr;
- ;
- break;}
- case 662:
- #line 3634 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 663:
- #line 3636 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 664:
- #line 3638 "gram.y"
- {
- /* could be a column name or a relation_name */
- Ident *n = makeNode(Ident);
- n->name = yyvsp[0].str;
- n->indirection = NULL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 665:
- #line 3646 "gram.y"
- { yyval.node = doNegate(yyvsp[0].node); ;
- break;}
- case 666:
- #line 3648 "gram.y"
- { yyval.node = makeA_Expr(OP, "%", NULL, yyvsp[0].node); ;
- break;}
- case 667:
- #line 3650 "gram.y"
- { yyval.node = makeA_Expr(OP, "^", NULL, yyvsp[0].node); ;
- break;}
- case 668:
- #line 3652 "gram.y"
- { yyval.node = makeA_Expr(OP, "%", yyvsp[-1].node, NULL); ;
- break;}
- case 669:
- #line 3654 "gram.y"
- { yyval.node = makeA_Expr(OP, "^", yyvsp[-1].node, NULL); ;
- break;}
- case 670:
- #line 3656 "gram.y"
- { yyval.node = makeA_Expr(OP, "+", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 671:
- #line 3658 "gram.y"
- { yyval.node = makeA_Expr(OP, "-", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 672:
- #line 3660 "gram.y"
- { yyval.node = makeA_Expr(OP, "/", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 673:
- #line 3662 "gram.y"
- { yyval.node = makeA_Expr(OP, "%", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 674:
- #line 3664 "gram.y"
- { yyval.node = makeA_Expr(OP, "*", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 675:
- #line 3666 "gram.y"
- { yyval.node = makeA_Expr(OP, "^", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 676:
- #line 3668 "gram.y"
- { yyval.node = makeA_Expr(OP, "<", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 677:
- #line 3670 "gram.y"
- { yyval.node = makeA_Expr(OP, ">", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 678:
- #line 3673 "gram.y"
- { yyval.node = makeA_Expr(ISNULL, NULL, yyvsp[-2].node, NULL); ;
- break;}
- case 679:
- #line 3676 "gram.y"
- { yyval.node = makeA_Expr(ISNULL, NULL, yyvsp[0].node, NULL); ;
- break;}
- case 680:
- #line 3679 "gram.y"
- { yyval.node = makeA_Expr(OP, "=", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 681:
- #line 3681 "gram.y"
- { yyval.node = makeA_Expr(OP, ":", NULL, yyvsp[0].node); ;
- break;}
- case 682:
- #line 3683 "gram.y"
- { yyval.node = makeA_Expr(OP, ";", NULL, yyvsp[0].node); ;
- break;}
- case 683:
- #line 3685 "gram.y"
- { yyval.node = makeA_Expr(OP, "|", NULL, yyvsp[0].node); ;
- break;}
- case 684:
- #line 3687 "gram.y"
- {
- yyval.node = (Node *)yyvsp[-2].node;
- /* AexprConst can be either A_Const or ParamNo */
- if (nodeTag(yyvsp[-2].node) == T_A_Const) {
- ((A_Const *)yyvsp[-2].node)->typename = yyvsp[0].typnam;
- } else if (nodeTag(yyvsp[-2].node) == T_Param) {
- ((ParamNo *)yyvsp[-2].node)->typename = yyvsp[0].typnam;
- /* otherwise, try to transform to a function call */
- } else {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[0].typnam->name;
- n->args = lcons(yyvsp[-2].node,NIL);
- yyval.node = (Node *)n;
- }
- ;
- break;}
- case 685:
- #line 3703 "gram.y"
- {
- yyval.node = (Node *)yyvsp[-3].node;
- /* AexprConst can be either A_Const or ParamNo */
- if (nodeTag(yyvsp[-3].node) == T_A_Const) {
- ((A_Const *)yyvsp[-3].node)->typename = yyvsp[-1].typnam;
- } else if (nodeTag(yyvsp[-1].typnam) == T_Param) {
- ((ParamNo *)yyvsp[-3].node)->typename = yyvsp[-1].typnam;
- /* otherwise, try to transform to a function call */
- } else {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-1].typnam->name;
- n->args = lcons(yyvsp[-3].node,NIL);
- yyval.node = (Node *)n;
- }
- ;
- break;}
- case 686:
- #line 3719 "gram.y"
- { yyval.node = yyvsp[-1].node; ;
- break;}
- case 687:
- #line 3721 "gram.y"
- { yyval.node = makeIndexable(yyvsp[-1].str,yyvsp[-2].node,yyvsp[0].node); ;
- break;}
- case 688:
- #line 3723 "gram.y"
- { yyval.node = makeIndexable("~~", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 689:
- #line 3725 "gram.y"
- { yyval.node = makeA_Expr(OP, "!~~", yyvsp[-3].node, yyvsp[0].node); ;
- break;}
- case 690:
- #line 3727 "gram.y"
- { yyval.node = makeA_Expr(OP, yyvsp[-1].str, NULL, yyvsp[0].node); ;
- break;}
- case 691:
- #line 3729 "gram.y"
- { yyval.node = makeA_Expr(OP, yyvsp[0].str, yyvsp[-1].node, NULL); ;
- break;}
- case 692:
- #line 3731 "gram.y"
- {
- /* cheap hack for aggregate (eg. count) */
- FuncCall *n = makeNode(FuncCall);
- A_Const *star = makeNode(A_Const);
- star->val.type = T_String;
- star->val.val.str = "";
- n->funcname = yyvsp[-3].str;
- n->args = lcons(star, NIL);
- yyval.node = (Node *)n;
- ;
- break;}
- case 693:
- #line 3743 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-2].str;
- n->args = NIL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 694:
- #line 3750 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-3].str;
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 695:
- #line 3757 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->val.type = T_String;
- n->val.val.str = "now";
- n->typename = t;
- t->name = xlateSqlType("date");
- t->setof = FALSE;
- t->typmod = -1;
-
- yyval.node = (Node *)n;
- ;
- break;}
- case 696:
- #line 3772 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->val.type = T_String;
- n->val.val.str = "now";
- n->typename = t;
- t->name = xlateSqlType("time");
- t->setof = FALSE;
- t->typmod = -1;
- yyval.node = (Node *)n;
- ;
- break;}
- case 697:
- #line 3787 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- A_Const *s = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->funcname = xlateSqlType("time");
- n->args = lcons(s, NIL);
- s->val.type = T_String;
- s->val.val.str = "now";
- s->typename = t;
- t->name = xlateSqlType("time");
- t->setof = FALSE;
- t->typmod = -1;
- if (yyvsp[-1].ival != 0)
- elog(NOTICE,"CURRENT_TIME(%d) precision not implemented; zero used instead",yyvsp[-1].ival);
- yyval.node = (Node *)n;
- ;
- break;}
- case 698:
- #line 3809 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->val.type = T_String;
- n->val.val.str = "now";
- n->typename = t;
- t->name = xlateSqlType("timestamp");
- t->setof = FALSE;
- t->typmod = -1;
- yyval.node = (Node *)n;
- ;
- break;}
- case 699:
- #line 3824 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- A_Const *s = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->funcname = xlateSqlType("timestamp");
- n->args = lcons(s, NIL);
- s->val.type = T_String;
- s->val.val.str = "now";
- s->typename = t;
- t->name = xlateSqlType("timestamp");
- t->setof = FALSE;
- t->typmod = -1;
- if (yyvsp[-1].ival != 0)
- elog(NOTICE,"CURRENT_TIMESTAMP(%d) precision not implemented; zero used instead",yyvsp[-1].ival);
- yyval.node = (Node *)n;
- ;
- break;}
- case 700:
- #line 3846 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "getpgusername";
- n->args = NIL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 701:
- #line 3853 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "getpgusername";
- n->args = NIL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 702:
- #line 3860 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = NIL;
- n->useor = false;
- n->oper = NIL;
- n->subLinkType = EXISTS_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 703:
- #line 3870 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "date_part";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 704:
- #line 3877 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "strpos";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 705:
- #line 3884 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "substr";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 706:
- #line 3892 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "btrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 707:
- #line 3899 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "ltrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 708:
- #line 3906 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "rtrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 709:
- #line 3913 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "btrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 710:
- #line 3920 "gram.y"
- { yyval.node = makeA_Expr(ISNULL, NULL, yyvsp[-1].node, NULL); ;
- break;}
- case 711:
- #line 3922 "gram.y"
- { yyval.node = makeA_Expr(ISNULL, NULL, yyvsp[-2].node, NULL); ;
- break;}
- case 712:
- #line 3924 "gram.y"
- { yyval.node = makeA_Expr(NOTNULL, NULL, yyvsp[-1].node, NULL); ;
- break;}
- case 713:
- #line 3926 "gram.y"
- { yyval.node = makeA_Expr(NOTNULL, NULL, yyvsp[-3].node, NULL); ;
- break;}
- case 714:
- #line 3933 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = "t";
- n->typename = makeNode(TypeName);
- n->typename->name = xlateSqlType("bool");
- n->typename->typmod = -1;
- yyval.node = makeA_Expr(OP, "=", yyvsp[-2].node,(Node *)n);
- ;
- break;}
- case 715:
- #line 3943 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = "t";
- n->typename = makeNode(TypeName);
- n->typename->name = xlateSqlType("bool");
- n->typename->typmod = -1;
- yyval.node = makeA_Expr(OP, "=", yyvsp[-3].node,(Node *)n);
- ;
- break;}
- case 716:
- #line 3953 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = "f";
- n->typename = makeNode(TypeName);
- n->typename->name = xlateSqlType("bool");
- n->typename->typmod = -1;
- yyval.node = makeA_Expr(OP, "=", yyvsp[-2].node,(Node *)n);
- ;
- break;}
- case 717:
- #line 3963 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = "f";
- n->typename = makeNode(TypeName);
- n->typename->name = xlateSqlType("bool");
- n->typename->typmod = -1;
- yyval.node = makeA_Expr(OP, "=", yyvsp[-3].node,(Node *)n);
- ;
- break;}
- case 718:
- #line 3973 "gram.y"
- {
- yyval.node = makeA_Expr(AND, NULL,
- makeA_Expr(OP, ">=", yyvsp[-4].node, yyvsp[-2].node),
- makeA_Expr(OP, "<=", yyvsp[-4].node, yyvsp[0].node));
- ;
- break;}
- case 719:
- #line 3979 "gram.y"
- {
- yyval.node = makeA_Expr(OR, NULL,
- makeA_Expr(OP, "<", yyvsp[-5].node, yyvsp[-2].node),
- makeA_Expr(OP, ">", yyvsp[-5].node, yyvsp[0].node));
- ;
- break;}
- case 720:
- #line 3984 "gram.y"
- { saved_In_Expr = lcons(yyvsp[-1].node,saved_In_Expr); ;
- break;}
- case 721:
- #line 3985 "gram.y"
- {
- saved_In_Expr = lnext(saved_In_Expr);
- if (nodeTag(yyvsp[-1].node) == T_SubLink)
- {
- SubLink *n = (SubLink *)yyvsp[-1].node;
- n->lefthand = lcons(yyvsp[-5].node, NIL);
- n->oper = lcons("=",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- yyval.node = (Node *)n;
- }
- else yyval.node = yyvsp[-1].node;
- ;
- break;}
- case 722:
- #line 3998 "gram.y"
- { saved_In_Expr = lcons(yyvsp[-2].node,saved_In_Expr); ;
- break;}
- case 723:
- #line 3999 "gram.y"
- {
- saved_In_Expr = lnext(saved_In_Expr);
- if (nodeTag(yyvsp[-1].node) == T_SubLink)
- {
- SubLink *n = (SubLink *)yyvsp[-1].node;
- n->lefthand = lcons(yyvsp[-6].node, NIL);
- n->oper = lcons("<>",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- yyval.node = (Node *)n;
- }
- else yyval.node = yyvsp[-1].node;
- ;
- break;}
- case 724:
- #line 4013 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons(yyvsp[-3].str,NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 725:
- #line 4023 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons("+",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 726:
- #line 4033 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons("-",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 727:
- #line 4043 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons("/",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 728:
- #line 4053 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons("%",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 729:
- #line 4063 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons("*",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 730:
- #line 4073 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons("<",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 731:
- #line 4083 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons(">",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 732:
- #line 4093 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-4].node, NULL);
- n->oper = lcons("=",NIL);
- n->useor = false;
- n->subLinkType = EXPR_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 733:
- #line 4103 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons(yyvsp[-4].str,NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 734:
- #line 4113 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons("+",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 735:
- #line 4123 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons("-",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 736:
- #line 4133 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons("/",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 737:
- #line 4143 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons("%",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 738:
- #line 4153 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons("*",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 739:
- #line 4163 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons("<",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 740:
- #line 4173 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons(">",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 741:
- #line 4183 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node,NIL);
- n->oper = lcons("=",NIL);
- n->useor = false;
- n->subLinkType = ANY_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 742:
- #line 4193 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons(yyvsp[-4].str,NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 743:
- #line 4203 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons("+",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 744:
- #line 4213 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons("-",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 745:
- #line 4223 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons("/",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 746:
- #line 4233 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons("%",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 747:
- #line 4243 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons("*",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 748:
- #line 4253 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons("<",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 749:
- #line 4263 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons(">",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 750:
- #line 4273 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->lefthand = lcons(yyvsp[-5].node, NULL);
- n->oper = lcons("=",NIL);
- n->useor = false;
- n->subLinkType = ALL_SUBLINK;
- n->subselect = yyvsp[-1].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 751:
- #line 4283 "gram.y"
- { yyval.node = makeA_Expr(AND, NULL, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 752:
- #line 4285 "gram.y"
- { yyval.node = makeA_Expr(OR, NULL, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 753:
- #line 4287 "gram.y"
- { yyval.node = makeA_Expr(NOT, NULL, NULL, yyvsp[0].node); ;
- break;}
- case 754:
- #line 4289 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 755:
- #line 4298 "gram.y"
- {
- yyvsp[-1].attr->indirection = yyvsp[0].list;
- yyval.node = (Node *)yyvsp[-1].attr;
- ;
- break;}
- case 756:
- #line 4303 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 757:
- #line 4305 "gram.y"
- {
- /* could be a column name or a relation_name */
- Ident *n = makeNode(Ident);
- n->name = yyvsp[0].str;
- n->indirection = NULL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 758:
- #line 4313 "gram.y"
- { yyval.node = doNegate(yyvsp[0].node); ;
- break;}
- case 759:
- #line 4315 "gram.y"
- { yyval.node = makeA_Expr(OP, "%", NULL, yyvsp[0].node); ;
- break;}
- case 760:
- #line 4317 "gram.y"
- { yyval.node = makeA_Expr(OP, "^", NULL, yyvsp[0].node); ;
- break;}
- case 761:
- #line 4319 "gram.y"
- { yyval.node = makeA_Expr(OP, "%", yyvsp[-1].node, NULL); ;
- break;}
- case 762:
- #line 4321 "gram.y"
- { yyval.node = makeA_Expr(OP, "^", yyvsp[-1].node, NULL); ;
- break;}
- case 763:
- #line 4323 "gram.y"
- { yyval.node = makeA_Expr(OP, "+", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 764:
- #line 4325 "gram.y"
- { yyval.node = makeA_Expr(OP, "-", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 765:
- #line 4327 "gram.y"
- { yyval.node = makeA_Expr(OP, "/", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 766:
- #line 4329 "gram.y"
- { yyval.node = makeA_Expr(OP, "%", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 767:
- #line 4331 "gram.y"
- { yyval.node = makeA_Expr(OP, "^", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 768:
- #line 4333 "gram.y"
- { yyval.node = makeA_Expr(OP, "*", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 769:
- #line 4335 "gram.y"
- { yyval.node = makeA_Expr(OP, ":", NULL, yyvsp[0].node); ;
- break;}
- case 770:
- #line 4337 "gram.y"
- { yyval.node = makeA_Expr(OP, ";", NULL, yyvsp[0].node); ;
- break;}
- case 771:
- #line 4339 "gram.y"
- { yyval.node = makeA_Expr(OP, "|", NULL, yyvsp[0].node); ;
- break;}
- case 772:
- #line 4341 "gram.y"
- {
- yyval.node = (Node *)yyvsp[-2].node;
- /* AexprConst can be either A_Const or ParamNo */
- if (nodeTag(yyvsp[-2].node) == T_A_Const) {
- ((A_Const *)yyvsp[-2].node)->typename = yyvsp[0].typnam;
- } else if (nodeTag(yyvsp[-2].node) == T_Param) {
- ((ParamNo *)yyvsp[-2].node)->typename = yyvsp[0].typnam;
- /* otherwise, try to transform to a function call */
- } else {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[0].typnam->name;
- n->args = lcons(yyvsp[-2].node,NIL);
- yyval.node = (Node *)n;
- }
- ;
- break;}
- case 773:
- #line 4357 "gram.y"
- {
- yyval.node = (Node *)yyvsp[-3].node;
- /* AexprConst can be either A_Const or ParamNo */
- if (nodeTag(yyvsp[-3].node) == T_A_Const) {
- ((A_Const *)yyvsp[-3].node)->typename = yyvsp[-1].typnam;
- } else if (nodeTag(yyvsp[-3].node) == T_Param) {
- ((ParamNo *)yyvsp[-3].node)->typename = yyvsp[-1].typnam;
- /* otherwise, try to transform to a function call */
- } else {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-1].typnam->name;
- n->args = lcons(yyvsp[-3].node,NIL);
- yyval.node = (Node *)n;
- }
- ;
- break;}
- case 774:
- #line 4373 "gram.y"
- { yyval.node = yyvsp[-1].node; ;
- break;}
- case 775:
- #line 4375 "gram.y"
- { yyval.node = makeIndexable(yyvsp[-1].str,yyvsp[-2].node,yyvsp[0].node); ;
- break;}
- case 776:
- #line 4377 "gram.y"
- { yyval.node = makeA_Expr(OP, yyvsp[-1].str, NULL, yyvsp[0].node); ;
- break;}
- case 777:
- #line 4379 "gram.y"
- { yyval.node = makeA_Expr(OP, yyvsp[0].str, yyvsp[-1].node, NULL); ;
- break;}
- case 778:
- #line 4381 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-2].str;
- n->args = NIL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 779:
- #line 4388 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-3].str;
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 780:
- #line 4395 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->val.type = T_String;
- n->val.val.str = "now";
- n->typename = t;
- t->name = xlateSqlType("date");
- t->setof = FALSE;
- t->typmod = -1;
- yyval.node = (Node *)n;
- ;
- break;}
- case 781:
- #line 4410 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->val.type = T_String;
- n->val.val.str = "now";
- n->typename = t;
- t->name = xlateSqlType("time");
- t->setof = FALSE;
- t->typmod = -1;
- yyval.node = (Node *)n;
- ;
- break;}
- case 782:
- #line 4425 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- A_Const *s = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->funcname = xlateSqlType("time");
- n->args = lcons(s, NIL);
- s->val.type = T_String;
- s->val.val.str = "now";
- s->typename = t;
- t->name = xlateSqlType("time");
- t->setof = FALSE;
- t->typmod = -1;
- if (yyvsp[-1].ival != 0)
- elog(NOTICE,"CURRENT_TIME(%d) precision not implemented; zero used instead",yyvsp[-1].ival);
- yyval.node = (Node *)n;
- ;
- break;}
- case 783:
- #line 4447 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->val.type = T_String;
- n->val.val.str = "now";
- n->typename = t;
- t->name = xlateSqlType("timestamp");
- t->setof = FALSE;
- t->typmod = -1;
- yyval.node = (Node *)n;
- ;
- break;}
- case 784:
- #line 4462 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- A_Const *s = makeNode(A_Const);
- TypeName *t = makeNode(TypeName);
- n->funcname = xlateSqlType("timestamp");
- n->args = lcons(s, NIL);
- s->val.type = T_String;
- s->val.val.str = "now";
- s->typename = t;
- t->name = xlateSqlType("timestamp");
- t->setof = FALSE;
- t->typmod = -1;
- if (yyvsp[-1].ival != 0)
- elog(NOTICE,"CURRENT_TIMESTAMP(%d) precision not implemented; zero used instead",yyvsp[-1].ival);
- yyval.node = (Node *)n;
- ;
- break;}
- case 785:
- #line 4484 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "getpgusername";
- n->args = NIL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 786:
- #line 4491 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "getpgusername";
- n->args = NIL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 787:
- #line 4498 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "strpos";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 788:
- #line 4505 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "substr";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 789:
- #line 4513 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "btrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 790:
- #line 4520 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "ltrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 791:
- #line 4527 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "rtrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 792:
- #line 4534 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "btrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 793:
- #line 4543 "gram.y"
- {
- A_Indices *ai = makeNode(A_Indices);
- ai->lidx = NULL;
- ai->uidx = yyvsp[-2].node;
- yyval.list = lcons(ai, yyvsp[0].list);
- ;
- break;}
- case 794:
- #line 4550 "gram.y"
- {
- A_Indices *ai = makeNode(A_Indices);
- ai->lidx = yyvsp[-4].node;
- ai->uidx = yyvsp[-2].node;
- yyval.list = lcons(ai, yyvsp[0].list);
- ;
- break;}
- case 795:
- #line 4557 "gram.y"
- { yyval.list = NIL; ;
- break;}
- case 796:
- #line 4561 "gram.y"
- { yyval.list = lcons(yyvsp[0].node, NIL); ;
- break;}
- case 797:
- #line 4563 "gram.y"
- { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node); ;
- break;}
- case 798:
- #line 4565 "gram.y"
- { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].node); ;
- break;}
- case 799:
- #line 4569 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = yyvsp[-2].str;
- yyval.list = lappend(lcons((Node *)n,NIL), yyvsp[0].node);
- ;
- break;}
- case 800:
- #line 4576 "gram.y"
- { yyval.list = NIL; ;
- break;}
- case 801:
- #line 4579 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 802:
- #line 4580 "gram.y"
- { yyval.str = "tz_hour"; ;
- break;}
- case 803:
- #line 4581 "gram.y"
- { yyval.str = "tz_minute"; ;
- break;}
- case 804:
- #line 4585 "gram.y"
- { yyval.list = makeList(yyvsp[0].node, yyvsp[-2].node, -1); ;
- break;}
- case 805:
- #line 4587 "gram.y"
- { yyval.list = NIL; ;
- break;}
- case 806:
- #line 4591 "gram.y"
- {
- yyvsp[-1].attr->indirection = yyvsp[0].list;
- yyval.node = (Node *)yyvsp[-1].attr;
- ;
- break;}
- case 807:
- #line 4596 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 808:
- #line 4598 "gram.y"
- { yyval.node = makeA_Expr(OP, "-", NULL, yyvsp[0].node); ;
- break;}
- case 809:
- #line 4600 "gram.y"
- { yyval.node = makeA_Expr(OP, "+", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 810:
- #line 4602 "gram.y"
- { yyval.node = makeA_Expr(OP, "-", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 811:
- #line 4604 "gram.y"
- { yyval.node = makeA_Expr(OP, "/", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 812:
- #line 4606 "gram.y"
- { yyval.node = makeA_Expr(OP, "%", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 813:
- #line 4608 "gram.y"
- { yyval.node = makeA_Expr(OP, "*", yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 814:
- #line 4610 "gram.y"
- { yyval.node = makeA_Expr(OP, "|", NULL, yyvsp[0].node); ;
- break;}
- case 815:
- #line 4612 "gram.y"
- {
- yyval.node = (Node *)yyvsp[-2].node;
- /* AexprConst can be either A_Const or ParamNo */
- if (nodeTag(yyvsp[-2].node) == T_A_Const) {
- ((A_Const *)yyvsp[-2].node)->typename = yyvsp[0].typnam;
- } else if (nodeTag(yyvsp[-2].node) == T_Param) {
- ((ParamNo *)yyvsp[-2].node)->typename = yyvsp[0].typnam;
- /* otherwise, try to transform to a function call */
- } else {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[0].typnam->name;
- n->args = lcons(yyvsp[-2].node,NIL);
- yyval.node = (Node *)n;
- }
- ;
- break;}
- case 816:
- #line 4628 "gram.y"
- {
- yyval.node = (Node *)yyvsp[-3].node;
- /* AexprConst can be either A_Const or ParamNo */
- if (nodeTag(yyvsp[-3].node) == T_A_Const) {
- ((A_Const *)yyvsp[-3].node)->typename = yyvsp[-1].typnam;
- } else if (nodeTag(yyvsp[-3].node) == T_Param) {
- ((ParamNo *)yyvsp[-3].node)->typename = yyvsp[-1].typnam;
- /* otherwise, try to transform to a function call */
- } else {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-1].typnam->name;
- n->args = lcons(yyvsp[-3].node,NIL);
- yyval.node = (Node *)n;
- }
- ;
- break;}
- case 817:
- #line 4644 "gram.y"
- { yyval.node = yyvsp[-1].node; ;
- break;}
- case 818:
- #line 4646 "gram.y"
- { yyval.node = makeA_Expr(OP, yyvsp[-1].str, yyvsp[-2].node, yyvsp[0].node); ;
- break;}
- case 819:
- #line 4648 "gram.y"
- { yyval.node = makeA_Expr(OP, yyvsp[-1].str, NULL, yyvsp[0].node); ;
- break;}
- case 820:
- #line 4650 "gram.y"
- { yyval.node = makeA_Expr(OP, yyvsp[0].str, yyvsp[-1].node, NULL); ;
- break;}
- case 821:
- #line 4652 "gram.y"
- {
- /* could be a column name or a relation_name */
- Ident *n = makeNode(Ident);
- n->name = yyvsp[0].str;
- n->indirection = NULL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 822:
- #line 4660 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-2].str;
- n->args = NIL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 823:
- #line 4667 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = yyvsp[-3].str;
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 824:
- #line 4674 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "strpos";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 825:
- #line 4681 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "substr";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 826:
- #line 4689 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "btrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 827:
- #line 4696 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "ltrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 828:
- #line 4703 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "rtrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 829:
- #line 4710 "gram.y"
- {
- FuncCall *n = makeNode(FuncCall);
- n->funcname = "btrim";
- n->args = yyvsp[-1].list;
- yyval.node = (Node *)n;
- ;
- break;}
- case 830:
- #line 4719 "gram.y"
- {
- yyval.list = nconc(nconc(yyvsp[-2].list,yyvsp[-1].list),yyvsp[0].list);
- ;
- break;}
- case 831:
- #line 4723 "gram.y"
- { yyval.list = NIL; ;
- break;}
- case 832:
- #line 4727 "gram.y"
- { yyval.list = yyvsp[0].list; ;
- break;}
- case 833:
- #line 4729 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_Integer;
- n->val.val.ival = 1;
- yyval.list = lcons((Node *)n,NIL);
- ;
- break;}
- case 834:
- #line 4738 "gram.y"
- { yyval.list = yyvsp[0].list; ;
- break;}
- case 835:
- #line 4740 "gram.y"
- { yyval.list = NIL; ;
- break;}
- case 836:
- #line 4744 "gram.y"
- { yyval.list = lappend(yyvsp[0].list, yyvsp[-2].node); ;
- break;}
- case 837:
- #line 4746 "gram.y"
- { yyval.list = yyvsp[0].list; ;
- break;}
- case 838:
- #line 4748 "gram.y"
- { yyval.list = yyvsp[0].list; ;
- break;}
- case 839:
- #line 4752 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->subselect = yyvsp[0].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 840:
- #line 4758 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 841:
- #line 4762 "gram.y"
- { yyval.node = makeA_Expr(OP, "=", lfirst(saved_In_Expr), yyvsp[0].node); ;
- break;}
- case 842:
- #line 4764 "gram.y"
- { yyval.node = makeA_Expr(OR, NULL, yyvsp[-2].node,
- makeA_Expr(OP, "=", lfirst(saved_In_Expr), yyvsp[0].node));
- ;
- break;}
- case 843:
- #line 4770 "gram.y"
- {
- SubLink *n = makeNode(SubLink);
- n->subselect = yyvsp[0].node;
- yyval.node = (Node *)n;
- ;
- break;}
- case 844:
- #line 4776 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 845:
- #line 4780 "gram.y"
- { yyval.node = makeA_Expr(OP, "<>", lfirst(saved_In_Expr), yyvsp[0].node); ;
- break;}
- case 846:
- #line 4782 "gram.y"
- { yyval.node = makeA_Expr(AND, NULL, yyvsp[-2].node,
- makeA_Expr(OP, "<>", lfirst(saved_In_Expr), yyvsp[0].node));
- ;
- break;}
- case 847:
- #line 4803 "gram.y"
- {
- CaseExpr *c = makeNode(CaseExpr);
- c->arg = yyvsp[-3].node;
- c->args = yyvsp[-2].list;
- c->defresult = yyvsp[-1].node;
- yyval.node = (Node *)c;
- ;
- break;}
- case 848:
- #line 4811 "gram.y"
- {
- CaseExpr *c = makeNode(CaseExpr);
- CaseWhen *w = makeNode(CaseWhen);
- /*
- A_Const *n = makeNode(A_Const);
- n->val.type = T_Null;
- w->result = (Node *)n;
- */
- w->expr = makeA_Expr(OP, "=", yyvsp[-3].node, yyvsp[-1].node);
- c->args = lcons(w, NIL);
- c->defresult = yyvsp[-3].node;
- yyval.node = (Node *)c;
- ;
- break;}
- case 849:
- #line 4825 "gram.y"
- {
- CaseExpr *c = makeNode(CaseExpr);
- CaseWhen *w;
- List *l;
- foreach (l,yyvsp[-1].list)
- {
- w = makeNode(CaseWhen);
- w->expr = makeA_Expr(NOTNULL, NULL, lfirst(l), NULL);
- w->result = lfirst(l);
- c->args = lappend(c->args, w);
- }
- yyval.node = (Node *)c;
- ;
- break;}
- case 850:
- #line 4841 "gram.y"
- { yyval.list = lappend(yyvsp[-1].list, yyvsp[0].node); ;
- break;}
- case 851:
- #line 4843 "gram.y"
- { yyval.list = lcons(yyvsp[0].node, NIL); ;
- break;}
- case 852:
- #line 4847 "gram.y"
- {
- CaseWhen *w = makeNode(CaseWhen);
- w->expr = yyvsp[-2].node;
- w->result = yyvsp[0].node;
- yyval.node = (Node *)w;
- ;
- break;}
- case 853:
- #line 4855 "gram.y"
- { yyval.node = yyvsp[0].node; ;
- break;}
- case 854:
- #line 4856 "gram.y"
- { yyval.node = NULL; ;
- break;}
- case 855:
- #line 4860 "gram.y"
- {
- yyvsp[-1].attr->indirection = yyvsp[0].list;
- yyval.node = (Node *)yyvsp[-1].attr;
- ;
- break;}
- case 856:
- #line 4865 "gram.y"
- {
- /* could be a column name or a relation_name */
- Ident *n = makeNode(Ident);
- n->name = yyvsp[0].str;
- n->indirection = NULL;
- yyval.node = (Node *)n;
- ;
- break;}
- case 857:
- #line 4873 "gram.y"
- { yyval.node = NULL; ;
- break;}
- case 858:
- #line 4877 "gram.y"
- {
- yyval.attr = makeNode(Attr);
- yyval.attr->relname = yyvsp[-2].str;
- yyval.attr->paramNo = NULL;
- yyval.attr->attrs = yyvsp[0].list;
- yyval.attr->indirection = NULL;
- ;
- break;}
- case 859:
- #line 4885 "gram.y"
- {
- yyval.attr = makeNode(Attr);
- yyval.attr->relname = NULL;
- yyval.attr->paramNo = yyvsp[-2].paramno;
- yyval.attr->attrs = yyvsp[0].list;
- yyval.attr->indirection = NULL;
- ;
- break;}
- case 860:
- #line 4895 "gram.y"
- { yyval.list = lcons(makeString(yyvsp[0].str), NIL); ;
- break;}
- case 861:
- #line 4897 "gram.y"
- { yyval.list = lappend(yyvsp[-2].list, makeString(yyvsp[0].str)); ;
- break;}
- case 862:
- #line 4899 "gram.y"
- { yyval.list = lappend(yyvsp[-2].list, makeString("*")); ;
- break;}
- case 863:
- #line 4910 "gram.y"
- { yyval.list = lappend(yyvsp[-2].list,yyvsp[0].target); ;
- break;}
- case 864:
- #line 4912 "gram.y"
- { yyval.list = lcons(yyvsp[0].target, NIL); ;
- break;}
- case 865:
- #line 4914 "gram.y"
- {
- ResTarget *rt = makeNode(ResTarget);
- Attr *att = makeNode(Attr);
- att->relname = "*";
- att->paramNo = NULL;
- att->attrs = NULL;
- att->indirection = NIL;
- rt->name = NULL;
- rt->indirection = NULL;
- rt->val = (Node *)att;
- yyval.list = lcons(rt, NIL);
- ;
- break;}
- case 866:
- #line 4929 "gram.y"
- {
- yyval.target = makeNode(ResTarget);
- yyval.target->name = yyvsp[-3].str;
- yyval.target->indirection = yyvsp[-2].list;
- yyval.target->val = (Node *)yyvsp[0].node;
- ;
- break;}
- case 867:
- #line 4936 "gram.y"
- {
- yyval.target = makeNode(ResTarget);
- yyval.target->name = NULL;
- yyval.target->indirection = yyvsp[0].list;
- yyval.target->val = (Node *)yyvsp[-1].attr;
- ;
- break;}
- case 868:
- #line 4943 "gram.y"
- {
- Attr *att = makeNode(Attr);
- att->relname = yyvsp[-2].str;
- att->paramNo = NULL;
- att->attrs = lcons(makeString("*"), NIL);
- att->indirection = NIL;
- yyval.target = makeNode(ResTarget);
- yyval.target->name = NULL;
- yyval.target->indirection = NULL;
- yyval.target->val = (Node *)att;
- ;
- break;}
- case 869:
- #line 4962 "gram.y"
- { yyval.list = lappend(yyvsp[-2].list, yyvsp[0].target); ;
- break;}
- case 870:
- #line 4964 "gram.y"
- { yyval.list = lcons(yyvsp[0].target, NIL); ;
- break;}
- case 871:
- #line 4969 "gram.y"
- {
- yyval.target = makeNode(ResTarget);
- yyval.target->name = yyvsp[0].str;
- yyval.target->indirection = NULL;
- yyval.target->val = (Node *)yyvsp[-2].node;
- ;
- break;}
- case 872:
- #line 4976 "gram.y"
- {
- yyval.target = makeNode(ResTarget);
- yyval.target->name = NULL;
- yyval.target->indirection = NULL;
- yyval.target->val = (Node *)yyvsp[0].node;
- ;
- break;}
- case 873:
- #line 4983 "gram.y"
- {
- Attr *att = makeNode(Attr);
- att->relname = yyvsp[-2].str;
- att->paramNo = NULL;
- att->attrs = lcons(makeString("*"), NIL);
- att->indirection = NIL;
- yyval.target = makeNode(ResTarget);
- yyval.target->name = NULL;
- yyval.target->indirection = NULL;
- yyval.target->val = (Node *)att;
- ;
- break;}
- case 874:
- #line 4995 "gram.y"
- {
- Attr *att = makeNode(Attr);
- att->relname = "*";
- att->paramNo = NULL;
- att->attrs = NULL;
- att->indirection = NIL;
- yyval.target = makeNode(ResTarget);
- yyval.target->name = NULL;
- yyval.target->indirection = NULL;
- yyval.target->val = (Node *)att;
- ;
- break;}
- case 875:
- #line 5008 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 876:
- #line 5009 "gram.y"
- { yyval.str = NULL; ;
- break;}
- case 877:
- #line 5013 "gram.y"
- {
- yyval.str = yyvsp[0].str;
- StrNCpy(saved_relname, yyvsp[0].str, NAMEDATALEN);
- ;
- break;}
- case 878:
- #line 5018 "gram.y"
- {
- /* disallow refs to variable system tables */
- if (strcmp(LogRelationName, yyvsp[0].str) == 0
- || strcmp(VariableRelationName, yyvsp[0].str) == 0)
- elog(ERROR,"%s cannot be accessed by users",yyvsp[0].str);
- else
- yyval.str = yyvsp[0].str;
- StrNCpy(saved_relname, yyvsp[0].str, NAMEDATALEN);
- ;
- break;}
- case 879:
- #line 5029 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 880:
- #line 5030 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 881:
- #line 5031 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 882:
- #line 5032 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 883:
- #line 5033 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 884:
- #line 5039 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 885:
- #line 5040 "gram.y"
- { yyval.str = xlateSqlFunc(yyvsp[0].str); ;
- break;}
- case 886:
- #line 5042 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 887:
- #line 5049 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_Integer;
- n->val.val.ival = yyvsp[0].ival;
- yyval.node = (Node *)n;
- ;
- break;}
- case 888:
- #line 5056 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_Float;
- n->val.val.dval = yyvsp[0].dval;
- yyval.node = (Node *)n;
- ;
- break;}
- case 889:
- #line 5063 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = yyvsp[0].str;
- yyval.node = (Node *)n;
- ;
- break;}
- case 890:
- #line 5070 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->typename = yyvsp[-1].typnam;
- n->val.type = T_String;
- n->val.val.str = yyvsp[0].str;
- yyval.node = (Node *)n;
- ;
- break;}
- case 891:
- #line 5078 "gram.y"
- { yyval.node = (Node *)yyvsp[0].paramno; ;
- break;}
- case 892:
- #line 5080 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = "t";
- n->typename = makeNode(TypeName);
- n->typename->name = xlateSqlType("bool");
- n->typename->typmod = -1;
- yyval.node = (Node *)n;
- ;
- break;}
- case 893:
- #line 5090 "gram.y"
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_String;
- n->val.val.str = "f";
- n->typename = makeNode(TypeName);
- n->typename->name = xlateSqlType("bool");
- n->typename->typmod = -1;
- yyval.node = (Node *)n;
- ;
- break;}
- case 894:
- #line 5102 "gram.y"
- {
- yyval.paramno = makeNode(ParamNo);
- yyval.paramno->number = yyvsp[-1].ival;
- yyval.paramno->indirection = yyvsp[0].list;
- ;
- break;}
- case 895:
- #line 5109 "gram.y"
- { yyval.ival = yyvsp[0].ival; ;
- break;}
- case 896:
- #line 5110 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 897:
- #line 5111 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 898:
- #line 5119 "gram.y"
- { yyval.str = xlateSqlType(yyvsp[0].str); ;
- break;}
- case 899:
- #line 5121 "gram.y"
- { yyval.str = xlateSqlType(yyvsp[0].str); ;
- break;}
- case 900:
- #line 5123 "gram.y"
- { yyval.str = xlateSqlType(yyvsp[0].str); ;
- break;}
- case 901:
- #line 5133 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 902:
- #line 5134 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 903:
- #line 5135 "gram.y"
- { yyval.str = "absolute"; ;
- break;}
- case 904:
- #line 5136 "gram.y"
- { yyval.str = "access"; ;
- break;}
- case 905:
- #line 5137 "gram.y"
- { yyval.str = "action"; ;
- break;}
- case 906:
- #line 5138 "gram.y"
- { yyval.str = "after"; ;
- break;}
- case 907:
- #line 5139 "gram.y"
- { yyval.str = "aggregate"; ;
- break;}
- case 908:
- #line 5140 "gram.y"
- { yyval.str = "backward"; ;
- break;}
- case 909:
- #line 5141 "gram.y"
- { yyval.str = "before"; ;
- break;}
- case 910:
- #line 5142 "gram.y"
- { yyval.str = "cache"; ;
- break;}
- case 911:
- #line 5143 "gram.y"
- { yyval.str = "committed"; ;
- break;}
- case 912:
- #line 5144 "gram.y"
- { yyval.str = "createdb"; ;
- break;}
- case 913:
- #line 5145 "gram.y"
- { yyval.str = "createuser"; ;
- break;}
- case 914:
- #line 5146 "gram.y"
- { yyval.str = "cycle"; ;
- break;}
- case 915:
- #line 5147 "gram.y"
- { yyval.str = "database"; ;
- break;}
- case 916:
- #line 5148 "gram.y"
- { yyval.str = "delimiters"; ;
- break;}
- case 917:
- #line 5149 "gram.y"
- { yyval.str = "double"; ;
- break;}
- case 918:
- #line 5150 "gram.y"
- { yyval.str = "each"; ;
- break;}
- case 919:
- #line 5151 "gram.y"
- { yyval.str = "encoding"; ;
- break;}
- case 920:
- #line 5152 "gram.y"
- { yyval.str = "exclusive"; ;
- break;}
- case 921:
- #line 5153 "gram.y"
- { yyval.str = "forward"; ;
- break;}
- case 922:
- #line 5154 "gram.y"
- { yyval.str = "function"; ;
- break;}
- case 923:
- #line 5155 "gram.y"
- { yyval.str = "handler"; ;
- break;}
- case 924:
- #line 5156 "gram.y"
- { yyval.str = "increment"; ;
- break;}
- case 925:
- #line 5157 "gram.y"
- { yyval.str = "index"; ;
- break;}
- case 926:
- #line 5158 "gram.y"
- { yyval.str = "inherits"; ;
- break;}
- case 927:
- #line 5159 "gram.y"
- { yyval.str = "insensitive"; ;
- break;}
- case 928:
- #line 5160 "gram.y"
- { yyval.str = "instead"; ;
- break;}
- case 929:
- #line 5161 "gram.y"
- { yyval.str = "isnull"; ;
- break;}
- case 930:
- #line 5162 "gram.y"
- { yyval.str = "isolation"; ;
- break;}
- case 931:
- #line 5163 "gram.y"
- { yyval.str = "key"; ;
- break;}
- case 932:
- #line 5164 "gram.y"
- { yyval.str = "language"; ;
- break;}
- case 933:
- #line 5165 "gram.y"
- { yyval.str = "lancompiler"; ;
- break;}
- case 934:
- #line 5166 "gram.y"
- { yyval.str = "level"; ;
- break;}
- case 935:
- #line 5167 "gram.y"
- { yyval.str = "location"; ;
- break;}
- case 936:
- #line 5168 "gram.y"
- { yyval.str = "match"; ;
- break;}
- case 937:
- #line 5169 "gram.y"
- { yyval.str = "maxvalue"; ;
- break;}
- case 938:
- #line 5170 "gram.y"
- { yyval.str = "minvalue"; ;
- break;}
- case 939:
- #line 5171 "gram.y"
- { yyval.str = "mode"; ;
- break;}
- case 940:
- #line 5172 "gram.y"
- { yyval.str = "next"; ;
- break;}
- case 941:
- #line 5173 "gram.y"
- { yyval.str = "nocreatedb"; ;
- break;}
- case 942:
- #line 5174 "gram.y"
- { yyval.str = "nocreateuser"; ;
- break;}
- case 943:
- #line 5175 "gram.y"
- { yyval.str = "nothing"; ;
- break;}
- case 944:
- #line 5176 "gram.y"
- { yyval.str = "notnull"; ;
- break;}
- case 945:
- #line 5177 "gram.y"
- { yyval.str = "of"; ;
- break;}
- case 946:
- #line 5178 "gram.y"
- { yyval.str = "oids"; ;
- break;}
- case 947:
- #line 5179 "gram.y"
- { yyval.str = "only"; ;
- break;}
- case 948:
- #line 5180 "gram.y"
- { yyval.str = "operator"; ;
- break;}
- case 949:
- #line 5181 "gram.y"
- { yyval.str = "option"; ;
- break;}
- case 950:
- #line 5182 "gram.y"
- { yyval.str = "password"; ;
- break;}
- case 951:
- #line 5183 "gram.y"
- { yyval.str = "prior"; ;
- break;}
- case 952:
- #line 5184 "gram.y"
- { yyval.str = "privileges"; ;
- break;}
- case 953:
- #line 5185 "gram.y"
- { yyval.str = "procedural"; ;
- break;}
- case 954:
- #line 5186 "gram.y"
- { yyval.str = "read"; ;
- break;}
- case 955:
- #line 5187 "gram.y"
- { yyval.str = "relative"; ;
- break;}
- case 956:
- #line 5188 "gram.y"
- { yyval.str = "rename"; ;
- break;}
- case 957:
- #line 5189 "gram.y"
- { yyval.str = "returns"; ;
- break;}
- case 958:
- #line 5190 "gram.y"
- { yyval.str = "row"; ;
- break;}
- case 959:
- #line 5191 "gram.y"
- { yyval.str = "rule"; ;
- break;}
- case 960:
- #line 5192 "gram.y"
- { yyval.str = "scroll"; ;
- break;}
- case 961:
- #line 5193 "gram.y"
- { yyval.str = "sequence"; ;
- break;}
- case 962:
- #line 5194 "gram.y"
- { yyval.str = "serial"; ;
- break;}
- case 963:
- #line 5195 "gram.y"
- { yyval.str = "serializable"; ;
- break;}
- case 964:
- #line 5196 "gram.y"
- { yyval.str = "share"; ;
- break;}
- case 965:
- #line 5197 "gram.y"
- { yyval.str = "start"; ;
- break;}
- case 966:
- #line 5198 "gram.y"
- { yyval.str = "statement"; ;
- break;}
- case 967:
- #line 5199 "gram.y"
- { yyval.str = "stdin"; ;
- break;}
- case 968:
- #line 5200 "gram.y"
- { yyval.str = "stdout"; ;
- break;}
- case 969:
- #line 5201 "gram.y"
- { yyval.str = "time"; ;
- break;}
- case 970:
- #line 5202 "gram.y"
- { yyval.str = "timestamp"; ;
- break;}
- case 971:
- #line 5203 "gram.y"
- { yyval.str = "timezone_hour"; ;
- break;}
- case 972:
- #line 5204 "gram.y"
- { yyval.str = "timezone_minute"; ;
- break;}
- case 973:
- #line 5205 "gram.y"
- { yyval.str = "trigger"; ;
- break;}
- case 974:
- #line 5206 "gram.y"
- { yyval.str = "trusted"; ;
- break;}
- case 975:
- #line 5207 "gram.y"
- { yyval.str = "type"; ;
- break;}
- case 976:
- #line 5208 "gram.y"
- { yyval.str = "valid"; ;
- break;}
- case 977:
- #line 5209 "gram.y"
- { yyval.str = "version"; ;
- break;}
- case 978:
- #line 5210 "gram.y"
- { yyval.str = "zone"; ;
- break;}
- case 979:
- #line 5223 "gram.y"
- { yyval.str = yyvsp[0].str; ;
- break;}
- case 980:
- #line 5224 "gram.y"
- { yyval.str = "abort"; ;
- break;}
- case 981:
- #line 5225 "gram.y"
- { yyval.str = "analyze"; ;
- break;}
- case 982:
- #line 5226 "gram.y"
- { yyval.str = "binary"; ;
- break;}
- case 983:
- #line 5227 "gram.y"
- { yyval.str = "case"; ;
- break;}
- case 984:
- #line 5228 "gram.y"
- { yyval.str = "cluster"; ;
- break;}
- case 985:
- #line 5229 "gram.y"
- { yyval.str = "coalesce"; ;
- break;}
- case 986:
- #line 5230 "gram.y"
- { yyval.str = "constraint"; ;
- break;}
- case 987:
- #line 5231 "gram.y"
- { yyval.str = "copy"; ;
- break;}
- case 988:
- #line 5232 "gram.y"
- { yyval.str = "current"; ;
- break;}
- case 989:
- #line 5233 "gram.y"
- { yyval.str = "do"; ;
- break;}
- case 990:
- #line 5234 "gram.y"
- { yyval.str = "else"; ;
- break;}
- case 991:
- #line 5235 "gram.y"
- { yyval.str = "end"; ;
- break;}
- case 992:
- #line 5236 "gram.y"
- { yyval.str = "explain"; ;
- break;}
- case 993:
- #line 5237 "gram.y"
- { yyval.str = "extend"; ;
- break;}
- case 994:
- #line 5238 "gram.y"
- { yyval.str = "false"; ;
- break;}
- case 995:
- #line 5239 "gram.y"
- { yyval.str = "foreign"; ;
- break;}
- case 996:
- #line 5240 "gram.y"
- { yyval.str = "global"; ;
- break;}
- case 997:
- #line 5241 "gram.y"
- { yyval.str = "group"; ;
- break;}
- case 998:
- #line 5242 "gram.y"
- { yyval.str = "listen"; ;
- break;}
- case 999:
- #line 5243 "gram.y"
- { yyval.str = "load"; ;
- break;}
- case 1000:
- #line 5244 "gram.y"
- { yyval.str = "local"; ;
- break;}
- case 1001:
- #line 5245 "gram.y"
- { yyval.str = "lock"; ;
- break;}
- case 1002:
- #line 5246 "gram.y"
- { yyval.str = "move"; ;
- break;}
- case 1003:
- #line 5247 "gram.y"
- { yyval.str = "new"; ;
- break;}
- case 1004:
- #line 5248 "gram.y"
- { yyval.str = "none"; ;
- break;}
- case 1005:
- #line 5249 "gram.y"
- { yyval.str = "nullif"; ;
- break;}
- case 1006:
- #line 5250 "gram.y"
- { yyval.str = "order"; ;
- break;}
- case 1007:
- #line 5251 "gram.y"
- { yyval.str = "position"; ;
- break;}
- case 1008:
- #line 5252 "gram.y"
- { yyval.str = "precision"; ;
- break;}
- case 1009:
- #line 5253 "gram.y"
- { yyval.str = "reset"; ;
- break;}
- case 1010:
- #line 5254 "gram.y"
- { yyval.str = "setof"; ;
- break;}
- case 1011:
- #line 5255 "gram.y"
- { yyval.str = "show"; ;
- break;}
- case 1012:
- #line 5256 "gram.y"
- { yyval.str = "table"; ;
- break;}
- case 1013:
- #line 5257 "gram.y"
- { yyval.str = "then"; ;
- break;}
- case 1014:
- #line 5258 "gram.y"
- { yyval.str = "transaction"; ;
- break;}
- case 1015:
- #line 5259 "gram.y"
- { yyval.str = "true"; ;
- break;}
- case 1016:
- #line 5260 "gram.y"
- { yyval.str = "vacuum"; ;
- break;}
- case 1017:
- #line 5261 "gram.y"
- { yyval.str = "verbose"; ;
- break;}
- case 1018:
- #line 5262 "gram.y"
- { yyval.str = "when"; ;
- break;}
- case 1019:
- #line 5266 "gram.y"
- {
- if (QueryIsRule)
- yyval.str = "*CURRENT*";
- else
- elog(ERROR,"CURRENT used in non-rule query");
- ;
- break;}
- case 1020:
- #line 5273 "gram.y"
- {
- if (QueryIsRule)
- yyval.str = "*NEW*";
- else
- elog(ERROR,"NEW used in non-rule query");
- ;
- break;}
- }
- /* the action file gets copied in in place of this dollarsign */
- #line 543 "/usr/share/misc/bison.simple"
- yyvsp -= yylen;
- yyssp -= yylen;
- #ifdef YYLSP_NEEDED
- yylsp -= yylen;
- #endif
- #if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "n");
- }
- #endif
- *++yyvsp = yyval;
- #ifdef YYLSP_NEEDED
- yylsp++;
- if (yylen == 0)
- {
- yylsp->first_line = yylloc.first_line;
- yylsp->first_column = yylloc.first_column;
- yylsp->last_line = (yylsp-1)->last_line;
- yylsp->last_column = (yylsp-1)->last_column;
- yylsp->text = 0;
- }
- else
- {
- yylsp->last_line = (yylsp+yylen-1)->last_line;
- yylsp->last_column = (yylsp+yylen-1)->last_column;
- }
- #endif
- /* Now "shift" the result of the reduction.
- Determine what state that goes to,
- based on the state we popped back to
- and the rule number reduced by. */
- yyn = yyr1[yyn];
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
- goto yynewstate;
- yyerrlab: /* here on detecting error */
- if (! yyerrstatus)
- /* If not already recovering from an error, report this error. */
- {
- ++yynerrs;
- #ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- int size = 0;
- char *msg;
- int x, count;
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen(yytname[x]) + 15, count++;
- msg = (char *) malloc(size + 15);
- if (msg != 0)
- {
- strcpy(msg, "parse error");
- if (count < 5)
- {
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- {
- strcat(msg, count == 0 ? ", expecting `" : " or `");
- strcat(msg, yytname[x]);
- strcat(msg, "'");
- count++;
- }
- }
- yyerror(msg);
- free(msg);
- }
- else
- yyerror ("parse error; also virtual memory exceeded");
- }
- else
- #endif /* YYERROR_VERBOSE */
- yyerror("parse error");
- }
- goto yyerrlab1;
- yyerrlab1: /* here on error raised explicitly by an action */
- if (yyerrstatus == 3)
- {
- /* if just tried and failed to reuse lookahead token after an error, discard it. */
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
- #if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).n", yychar, yytname[yychar1]);
- #endif
- yychar = YYEMPTY;
- }
- /* Else will try to reuse lookahead token
- after shifting the error token. */
- yyerrstatus = 3; /* Each real token shifted decrements this */
- goto yyerrhandle;
- yyerrdefault: /* current state does not do anything special for the error token. */
- #if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- if (yyn) goto yydefault;
- #endif
- yyerrpop: /* pop the current state because it cannot handle the error token */
- if (yyssp == yyss) YYABORT;
- yyvsp--;
- yystate = *--yyssp;
- #ifdef YYLSP_NEEDED
- yylsp--;
- #endif
- #if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "n");
- }
- #endif
- yyerrhandle:
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
- if (yyn == YYFINAL)
- YYACCEPT;
- #if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting error token, ");
- #endif
- *++yyvsp = yylval;
- #ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
- #endif
- yystate = yyn;
- goto yynewstate;
- yyacceptlab:
- /* YYACCEPT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
- #ifdef YYLSP_NEEDED
- free (yyls);
- #endif
- }
- return 0;
- yyabortlab:
- /* YYABORT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
- #ifdef YYLSP_NEEDED
- free (yyls);
- #endif
- }
- return 1;
- }
- #line 5281 "gram.y"
- static Node *
- makeA_Expr(int oper, char *opname, Node *lexpr, Node *rexpr)
- {
- A_Expr *a = makeNode(A_Expr);
- a->oper = oper;
- a->opname = opname;
- a->lexpr = lexpr;
- a->rexpr = rexpr;
- return (Node *)a;
- }
- /* makeRowExpr()
- * Generate separate operator nodes for a single row descriptor expression.
- * Perhaps this should go deeper in the parser someday...
- * - thomas 1997-12-22
- */
- static Node *
- makeRowExpr(char *opr, List *largs, List *rargs)
- {
- Node *expr = NULL;
- Node *larg, *rarg;
- if (length(largs) != length(rargs))
- elog(ERROR,"Unequal number of entries in row expression");
- if (lnext(largs) != NIL)
- expr = makeRowExpr(opr,lnext(largs),lnext(rargs));
- larg = lfirst(largs);
- rarg = lfirst(rargs);
- if ((strcmp(opr, "=") == 0)
- || (strcmp(opr, "<") == 0)
- || (strcmp(opr, "<=") == 0)
- || (strcmp(opr, ">") == 0)
- || (strcmp(opr, ">=") == 0))
- {
- if (expr == NULL)
- expr = makeA_Expr(OP, opr, larg, rarg);
- else
- expr = makeA_Expr(AND, NULL, expr, makeA_Expr(OP, opr, larg, rarg));
- }
- else if (strcmp(opr, "<>") == 0)
- {
- if (expr == NULL)
- expr = makeA_Expr(OP, opr, larg, rarg);
- else
- expr = makeA_Expr(OR, NULL, expr, makeA_Expr(OP, opr, larg, rarg));
- }
- else
- {
- elog(ERROR,"Operator '%s' not implemented for row expressions",opr);
- }
- return expr;
- }
- static void
- mapTargetColumns(List *src, List *dst)
- {
- ColumnDef *s;
- ResTarget *d;
- if (length(src) != length(dst))
- elog(ERROR,"CREATE TABLE/AS SELECT has mismatched column count");
- while ((src != NIL) && (dst != NIL))
- {
- s = (ColumnDef *)lfirst(src);
- d = (ResTarget *)lfirst(dst);
- d->name = s->colname;
- src = lnext(src);
- dst = lnext(dst);
- }
- return;
- } /* mapTargetColumns() */
- static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr)
- {
- Node *result = NULL;
-
- /* we do this so indexes can be used */
- if (strcmp(opname,"~") == 0 ||
- strcmp(opname,"~*") == 0)
- {
- if (nodeTag(rexpr) == T_A_Const &&
- ((A_Const *)rexpr)->val.type == T_String &&
- ((A_Const *)rexpr)->val.val.str[0] == '^')
- {
- A_Const *n = (A_Const *)rexpr;
- char *match_least = palloc(strlen(n->val.val.str)+2);
- char *match_most = palloc(strlen(n->val.val.str)+2);
- int pos, match_pos=0;
- bool found_special = false;
- /* Cannot optimize if unquoted | { } is present in pattern */
- for (pos = 1; n->val.val.str[pos]; pos++)
- {
- if (n->val.val.str[pos] == '|' ||
- n->val.val.str[pos] == '{' ||
- n->val.val.str[pos] == '}')
- {
- found_special = true;
- break;
- }
- if (n->val.val.str[pos] == '\')
- {
- pos++;
- if (n->val.val.str[pos] == ' ')
- break;
- }
- }
- if (!found_special)
- {
- /* note start at pos 1 to skip leading ^ */
- for (pos = 1; n->val.val.str[pos]; pos++)
- {
- if (n->val.val.str[pos] == '.' ||
- n->val.val.str[pos] == '?' ||
- n->val.val.str[pos] == '*' ||
- n->val.val.str[pos] == '[' ||
- n->val.val.str[pos] == '$' ||
- (strcmp(opname,"~*") == 0 && isalpha(n->val.val.str[pos])))
- break;
- if (n->val.val.str[pos] == '\')
- {
- pos++;
- if (n->val.val.str[pos] == ' ')
- break;
- }
- match_least[match_pos] = n->val.val.str[pos];
- match_most[match_pos++] = n->val.val.str[pos];
- }
-
- if (match_pos != 0)
- {
- A_Const *least = makeNode(A_Const);
- A_Const *most = makeNode(A_Const);
-
- /* make strings to be used in index use */
- match_least[match_pos] = ' ';
- match_most[match_pos] = '377';
- match_most[match_pos+1] = ' ';
- least->val.type = T_String;
- least->val.val.str = match_least;
- most->val.type = T_String;
- most->val.val.str = match_most;
- #ifdef USE_LOCALE
- result = makeA_Expr(AND, NULL,
- makeA_Expr(OP, "~", lexpr, rexpr),
- makeA_Expr(OP, ">=", lexpr, (Node *)least));
- #else
- result = makeA_Expr(AND, NULL,
- makeA_Expr(OP, "~", lexpr, rexpr),
- makeA_Expr(AND, NULL,
- makeA_Expr(OP, ">=", lexpr, (Node *)least),
- makeA_Expr(OP, "<=", lexpr, (Node *)most)));
- #endif
- }
- }
- }
- }
- else if (strcmp(opname,"~~") == 0)
- {
- if (nodeTag(rexpr) == T_A_Const &&
- ((A_Const *)rexpr)->val.type == T_String)
- {
- A_Const *n = (A_Const *)rexpr;
- char *match_least = palloc(strlen(n->val.val.str)+2);
- char *match_most = palloc(strlen(n->val.val.str)+2);
- int pos, match_pos=0;
-
- for (pos = 0; n->val.val.str[pos]; pos++)
- {
- /* % and _ are wildcard characters in LIKE */
- if (n->val.val.str[pos] == '%' ||
- n->val.val.str[pos] == '_')
- break;
- /* Backslash quotes the next character */
- if (n->val.val.str[pos] == '\')
- {
- pos++;
- if (n->val.val.str[pos] == ' ')
- break;
- }
- /*
- * NOTE: this code used to think that %% meant a literal %,
- * but textlike() itself does not think that, and the SQL92
- * spec doesn't say any such thing either.
- */
- match_least[match_pos] = n->val.val.str[pos];
- match_most[match_pos++] = n->val.val.str[pos];
- }
-
- if (match_pos != 0)
- {
- A_Const *least = makeNode(A_Const);
- A_Const *most = makeNode(A_Const);
-
- /* make strings to be used in index use */
- match_least[match_pos] = ' ';
- match_most[match_pos] = '377';
- match_most[match_pos+1] = ' ';
- least->val.type = T_String;
- least->val.val.str = match_least;
- most->val.type = T_String;
- most->val.val.str = match_most;
- #ifdef USE_LOCALE
- result = makeA_Expr(AND, NULL,
- makeA_Expr(OP, "~~", lexpr, rexpr),
- makeA_Expr(OP, ">=", lexpr, (Node *)least));
- #else
- result = makeA_Expr(AND, NULL,
- makeA_Expr(OP, "~~", lexpr, rexpr),
- makeA_Expr(AND, NULL,
- makeA_Expr(OP, ">=", lexpr, (Node *)least),
- makeA_Expr(OP, "<=", lexpr, (Node *)most)));
- #endif
- }
- }
- }
-
- if (result == NULL)
- result = makeA_Expr(OP, opname, lexpr, rexpr);
- return result;
- } /* makeIndexable() */
- /* xlateSqlFunc()
- * Convert alternate type names to internal Postgres types.
- * Do not convert "float", since that is handled elsewhere
- * for FLOAT(p) syntax.
- */
- static char *
- xlateSqlFunc(char *name)
- {
- if (!strcasecmp(name,"character_length")
- || !strcasecmp(name,"char_length"))
- return "length";
- else
- return name;
- } /* xlateSqlFunc() */
- /* xlateSqlType()
- * Convert alternate type names to internal Postgres types.
- */
- static char *
- xlateSqlType(char *name)
- {
- if (!strcasecmp(name,"int")
- || !strcasecmp(name,"integer"))
- return "int4";
- else if (!strcasecmp(name, "smallint"))
- return "int2";
- else if (!strcasecmp(name, "real")
- || !strcasecmp(name, "float"))
- return "float8";
- else if (!strcasecmp(name, "interval"))
- return "timespan";
- else if (!strcasecmp(name, "boolean"))
- return "bool";
- else
- return name;
- } /* xlateSqlType() */
- void parser_init(Oid *typev, int nargs)
- {
- QueryIsRule = FALSE;
- saved_relname[0]= ' ';
- saved_In_Expr = NULL;
- param_type_init(typev, nargs);
- }
- /* FlattenStringList()
- * Traverse list of string nodes and convert to a single string.
- * Used for reconstructing string form of complex expressions.
- *
- * Allocate at least one byte for terminator.
- */
- static char *
- FlattenStringList(List *list)
- {
- List *l;
- Value *v;
- char *s;
- char *sp;
- int nlist, len = 0;
- nlist = length(list);
- l = list;
- while(l != NIL) {
- v = (Value *)lfirst(l);
- sp = v->val.str;
- l = lnext(l);
- len += strlen(sp);
- };
- len += nlist;
- s = (char*) palloc(len+1);
- *s = ' ';
- l = list;
- while(l != NIL) {
- v = (Value *)lfirst(l);
- sp = v->val.str;
- l = lnext(l);
- strcat(s,sp);
- if (l != NIL) strcat(s," ");
- };
- *(s+len) = ' ';
- return s;
- } /* FlattenStringList() */
- /* makeConstantList()
- * Convert constant value node into string node.
- */
- static List *
- makeConstantList( A_Const *n)
- {
- List *result = NIL;
- char *typval = NULL;
- char *defval = NULL;
- if (nodeTag(n) != T_A_Const) {
- elog(ERROR,"Cannot handle non-constant parameter");
- } else if (n->val.type == T_Float) {
- defval = (char*) palloc(20+1);
- sprintf( defval, "%g", n->val.val.dval);
- result = lcons( makeString(defval), NIL);
- } else if (n->val.type == T_Integer) {
- defval = (char*) palloc(20+1);
- sprintf( defval, "%ld", n->val.val.ival);
- result = lcons( makeString(defval), NIL);
- } else if (n->val.type == T_String) {
- defval = (char*) palloc(strlen( ((A_Const *) n)->val.val.str) + 3);
- strcpy( defval, "'");
- strcat( defval, ((A_Const *) n)->val.val.str);
- strcat( defval, "'");
- if (n->typename != NULL)
- {
- typval = (char*) palloc(strlen( n->typename->name) + 1);
- strcpy(typval, n->typename->name);
- result = lappend( lcons( makeString(typval), NIL), makeString(defval));
- }
- else
- {
- result = lcons( makeString(defval), NIL);
- }
- } else {
- elog(ERROR,"Internal error in makeConstantList(): cannot encode node");
- };
- return result;
- } /* makeConstantList() */
- /* fmtId()
- * Check input string for non-lowercase/non-numeric characters.
- * Returns either input string or input surrounded by double quotes.
- */
- static char *
- fmtId(char *rawid)
- {
- static char *cp;
- for (cp = rawid; *cp != ' '; cp++)
- if (! (islower(*cp) || isdigit(*cp) || (*cp == '_'))) break;
- if (*cp != ' ') {
- cp = palloc(strlen(rawid)+3);
- strcpy(cp,""");
- strcat(cp,rawid);
- strcat(cp,""");
- } else {
- cp = rawid;
- };
- return cp;
- }
- /*
- * param_type_init()
- *
- * keep enough information around fill out the type of param nodes
- * used in postquel functions
- */
- static void
- param_type_init(Oid *typev, int nargs)
- {
- pfunc_num_args = nargs;
- param_type_info = typev;
- }
- Oid param_type(int t)
- {
- if ((t > pfunc_num_args) || (t == 0))
- return InvalidOid;
- return param_type_info[t - 1];
- }
- /*
- * The optimizer doesn't like '-' 4 for index use. It only checks for
- * Var '=' Const. It wants an integer of -4, so we try to merge the
- * minus into the constant.
- */
- static Node *doNegate(Node *n)
- {
- if (IsA(n, A_Const))
- {
- A_Const *con = (A_Const *)n;
- if (con->val.type == T_Integer)
- {
- con->val.val.ival = -con->val.val.ival;
- return n;
- }
- if (con->val.type == T_Float)
- {
- con->val.val.dval = -con->val.val.dval;
- return n;
- }
- }
- return makeA_Expr(OP, "-", NULL, n);
- }