*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.37 1998/12/04 15:34:30 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.38 1998/12/13 23:56:43 thomas Exp $
*
*-------------------------------------------------------------------------
*/
{
/*
- * look for a column name or a relation name (the default
- * behavior)
+ * look for a column name or a relation name (the default behavior)
*/
result = transformIdent(pstate, expr, precedence);
break;
w->expr = (Node *)a;
}
lfirst(args) = transformExpr(pstate, (Node *) w, precedence);
-
- if (w->result == NULL)
- {
- A_Const *n = makeNode(A_Const);
- n->val.type = T_Null;
- w->result = (Node *)n;
- }
}
if (c->defresult == NULL)
}
}
- /* Convert default clause, if necessary */
+ /* Convert default result clause, if necessary */
if (c->casetype != ptype)
{
if (! c->casetype)
elog(ERROR,"WHEN clause must have a boolean result");
/* result is NULL for NULLIF() construct - thomas 1998-11-11 */
- if (w->result != NULL)
- w->result = transformExpr(pstate, (Node *) w->result, precedence);
+ if (w->result == NULL)
+ {
+ A_Const *n = makeNode(A_Const);
+ n->val.type = T_Null;
+ w->result = (Node *)n;
+ }
+ w->result = transformExpr(pstate, (Node *) w->result, precedence);
result = expr;
break;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.31 1998/12/04 15:34:30 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.32 1998/12/13 23:56:44 thomas Exp $
*
*-------------------------------------------------------------------------
*/
static List *ExpandAllTables(ParseState *pstate);
-static char *FigureColname(Node *expr, Node *resval);
+char *FigureColname(Node *expr, Node *resval);
static Node *SizeTargetExpr(ParseState *pstate,
Node *expr,
* list, we have to guess.
*
*/
-static char *
+char *
FigureColname(Node *expr, Node *resval)
{
switch (nodeTag(expr))
return ((FuncCall *) resval)->funcname;
}
break;
+ case T_CaseExpr:
+ {
+ char *name;
+ name = FigureColname(((CaseExpr *) expr)->defresult, resval);
+ if (!strcmp(name, "?column?"))
+ name = "case";
+ return name;
+ }
+ break;
default:
break;
}