diff options
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r-- | src/backend/parser/parse_expr.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 72cb64a63d0..12c93e15f41 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.253 2010/01/02 16:57:49 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.254 2010/02/26 02:00:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -61,7 +61,7 @@ static Node *transformBooleanTest(ParseState *pstate, BooleanTest *b); static Node *transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr); static Node *transformColumnRef(ParseState *pstate, ColumnRef *cref); static Node *transformWholeRowRef(ParseState *pstate, RangeTblEntry *rte, - int location); + int location); static Node *transformIndirection(ParseState *pstate, Node *basenode, List *indirection); static Node *transformTypeCast(ParseState *pstate, TypeCast *tc); @@ -172,8 +172,8 @@ transformExpr(ParseState *pstate, Node *expr) * not a domain, transformTypeCast is a no-op. */ targetType = getBaseTypeAndTypmod(targetType, - &targetTypmod); - + &targetTypmod); + tc = copyObject(tc); tc->arg = transformArrayExpr(pstate, (A_ArrayExpr *) tc->arg, @@ -466,7 +466,8 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) char *colname = NULL; RangeTblEntry *rte; int levels_up; - enum { + enum + { CRERR_NO_COLUMN, CRERR_NO_RTE, CRERR_WRONG_DB, @@ -474,7 +475,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) } crerr = CRERR_NO_COLUMN; /* - * Give the PreParseColumnRefHook, if any, first shot. If it returns + * Give the PreParseColumnRefHook, if any, first shot. If it returns * non-null then that's all, folks. */ if (pstate->p_pre_columnref_hook != NULL) @@ -708,22 +709,22 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) break; } default: - crerr = CRERR_TOO_MANY; /* too many dotted names */ + crerr = CRERR_TOO_MANY; /* too many dotted names */ break; } /* * Now give the PostParseColumnRefHook, if any, a chance. We pass the * translation-so-far so that it can throw an error if it wishes in the - * case that it has a conflicting interpretation of the ColumnRef. - * (If it just translates anyway, we'll throw an error, because we can't - * undo whatever effects the preceding steps may have had on the pstate.) - * If it returns NULL, use the standard translation, or throw a suitable - * error if there is none. + * case that it has a conflicting interpretation of the ColumnRef. (If it + * just translates anyway, we'll throw an error, because we can't undo + * whatever effects the preceding steps may have had on the pstate.) If it + * returns NULL, use the standard translation, or throw a suitable error + * if there is none. */ if (pstate->p_post_columnref_hook != NULL) { - Node *hookresult; + Node *hookresult; hookresult = (*pstate->p_post_columnref_hook) (pstate, cref, node); if (node == NULL) @@ -765,15 +766,15 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) case CRERR_WRONG_DB: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cross-database references are not implemented: %s", - NameListToString(cref->fields)), + errmsg("cross-database references are not implemented: %s", + NameListToString(cref->fields)), parser_errposition(pstate, cref->location))); break; case CRERR_TOO_MANY: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("improper qualified name (too many dotted names): %s", - NameListToString(cref->fields)), + errmsg("improper qualified name (too many dotted names): %s", + NameListToString(cref->fields)), parser_errposition(pstate, cref->location))); break; } @@ -788,7 +789,7 @@ transformParamRef(ParseState *pstate, ParamRef *pref) Node *result; /* - * The core parser knows nothing about Params. If a hook is supplied, + * The core parser knows nothing about Params. If a hook is supplied, * call it. If not, or if the hook returns NULL, throw a generic error. */ if (pstate->p_paramref_hook != NULL) @@ -1972,10 +1973,10 @@ transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr) /* * Check to see if the cursor name matches a parameter of type REFCURSOR. - * If so, replace the raw name reference with a parameter reference. - * (This is a hack for the convenience of plpgsql.) + * If so, replace the raw name reference with a parameter reference. (This + * is a hack for the convenience of plpgsql.) */ - if (cexpr->cursor_name != NULL) /* in case already transformed */ + if (cexpr->cursor_name != NULL) /* in case already transformed */ { ColumnRef *cref = makeNode(ColumnRef); Node *node = NULL; @@ -1991,13 +1992,13 @@ transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr) node = (*pstate->p_post_columnref_hook) (pstate, cref, NULL); /* - * XXX Should we throw an error if we get a translation that isn't - * a refcursor Param? For now it seems best to silently ignore - * false matches. + * XXX Should we throw an error if we get a translation that isn't a + * refcursor Param? For now it seems best to silently ignore false + * matches. */ if (node != NULL && IsA(node, Param)) { - Param *p = (Param *) node; + Param *p = (Param *) node; if (p->paramkind == PARAM_EXTERN && p->paramtype == REFCURSOROID) |