From ad161bcc8a3792d18ef2f3ebe66bb1e22d42b6f2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 6 Apr 2005 16:34:07 +0000 Subject: Merge Resdom nodes into TargetEntry nodes to simplify code and save a few palloc's. I also chose to eliminate the restype and restypmod fields entirely, since they are redundant with information stored in the node's contained expression; re-examining the expression at need seems simpler and more reliable than trying to keep restype/restypmod up to date. initdb forced due to change in contents of stored rules. --- src/backend/commands/view.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/backend/commands/view.c') diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index 10caef1375b..21609e063fa 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.87 2005/02/02 06:36:00 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.88 2005/04/06 16:34:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -22,6 +22,7 @@ #include "miscadmin.h" #include "nodes/makefuncs.h" #include "optimizer/clauses.h" +#include "parser/parse_expr.h" #include "parser/parse_relation.h" #include "rewrite/rewriteDefine.h" #include "rewrite/rewriteManip.h" @@ -106,18 +107,17 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace) attrList = NIL; foreach(t, tlist) { - TargetEntry *entry = lfirst(t); - Resdom *res = entry->resdom; + TargetEntry *tle = lfirst(t); - if (!res->resjunk) + if (!tle->resjunk) { ColumnDef *def = makeNode(ColumnDef); TypeName *typename = makeNode(TypeName); - def->colname = pstrdup(res->resname); + def->colname = pstrdup(tle->resname); - typename->typeid = res->restype; - typename->typmod = res->restypmod; + typename->typeid = exprType((Node *) tle->expr); + typename->typmod = exprTypmod((Node *) tle->expr); def->typename = typename; def->inhcount = 0; -- cgit v1.2.3