@ -198,6 +198,8 @@ static Node *makeAndExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeOrExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeOrExpr(Node *lexpr, Node *rexpr, int location);
static Node *makeNotExpr(Node *expr, int location);
static Node *makeNotExpr(Node *expr, int location);
static Node *makeAArrayExpr(List *elements, int location);
static Node *makeAArrayExpr(List *elements, int location);
static Node *makeSQLValueFunction(SQLValueFunctionOp op, int32 typmod,
int location);
static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args,
static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args,
List *args, int location);
List *args, int location);
static List *mergeTableFuncParameters(List *func_args, List *columns);
static List *mergeTableFuncParameters(List *func_args, List *columns);
@ -15288,87 +15290,51 @@ func_expr_common_subexpr:
}
}
| CURRENT_DATE
| CURRENT_DATE
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_date"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_DATE, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_TIME
| CURRENT_TIME
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_time"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_TIME, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_TIME '(' Iconst ')'
| CURRENT_TIME '(' Iconst ')'
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_time"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_TIME_N, $3, @1);
list_make1(makeIntConst($3, @3)),
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_TIMESTAMP
| CURRENT_TIMESTAMP
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_timestamp"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_TIMESTAMP, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_TIMESTAMP '(' Iconst ')'
| CURRENT_TIMESTAMP '(' Iconst ')'
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_timestamp"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_TIMESTAMP_N, $3, @1);
list_make1(makeIntConst($3, @3)),
COERCE_SQL_SYNTAX,
@1);
}
}
| LOCALTIME
| LOCALTIME
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("localtime"),
$$ = makeSQLValueFunction(SVFOP_LOCALTIME, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| LOCALTIME '(' Iconst ')'
| LOCALTIME '(' Iconst ')'
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("localtime"),
$$ = makeSQLValueFunction(SVFOP_LOCALTIME_N, $3, @1);
list_make1(makeIntConst($3, @3)),
COERCE_SQL_SYNTAX,
@1);
}
}
| LOCALTIMESTAMP
| LOCALTIMESTAMP
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("localtimestamp"),
$$ = makeSQLValueFunction(SVFOP_LOCALTIMESTAMP, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| LOCALTIMESTAMP '(' Iconst ')'
| LOCALTIMESTAMP '(' Iconst ')'
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("localtimestamp"),
$$ = makeSQLValueFunction(SVFOP_LOCALTIMESTAMP_N, $3, @1);
list_make1(makeIntConst($3, @3)),
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_ROLE
| CURRENT_ROLE
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_role"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_ROLE, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_USER
| CURRENT_USER
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_user"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_USER, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| SESSION_USER
| SESSION_USER
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("session_user"),
$$ = makeSQLValueFunction(SVFOP_SESSION_USER, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| SYSTEM_USER
| SYSTEM_USER
{
{
@ -15379,24 +15345,15 @@ func_expr_common_subexpr:
}
}
| USER
| USER
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("user"),
$$ = makeSQLValueFunction(SVFOP_USER, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_CATALOG
| CURRENT_CATALOG
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_catalog"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_CATALOG, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| CURRENT_SCHEMA
| CURRENT_SCHEMA
{
{
$$ = (Node *) makeFuncCall(SystemFuncName("current_schema"),
$$ = makeSQLValueFunction(SVFOP_CURRENT_SCHEMA, -1, @1);
NIL,
COERCE_SQL_SYNTAX,
@1);
}
}
| CAST '(' a_expr AS Typename ')'
| CAST '(' a_expr AS Typename ')'
{ $$ = makeTypeCast($3, $5, @1); }
{ $$ = makeTypeCast($3, $5, @1); }
@ -18519,6 +18476,18 @@ makeAArrayExpr(List *elements, int location)
return (Node *) n;
return (Node *) n;
}
}
static Node *
makeSQLValueFunction(SQLValueFunctionOp op, int32 typmod, int location)
{
SQLValueFunction *svf = makeNode(SQLValueFunction);
svf->op = op;
/* svf->type will be filled during parse analysis */
svf->typmod = typmod;
svf->location = location;
return (Node *) svf;
}
static Node *
static Node *
makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
int location)
int location)