aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/view.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-06 16:34:07 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-06 16:34:07 +0000
commitad161bcc8a3792d18ef2f3ebe66bb1e22d42b6f2 (patch)
tree18ec8963fbd1d6dd62ad214bfe3552fc2e7d06eb /src/backend/commands/view.c
parent0f3748a28c42d09d794ff00af3f1f992eaa5fd7c (diff)
downloadpostgresql-ad161bcc8a3792d18ef2f3ebe66bb1e22d42b6f2.tar.gz
postgresql-ad161bcc8a3792d18ef2f3ebe66bb1e22d42b6f2.zip
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.
Diffstat (limited to 'src/backend/commands/view.c')
-rw-r--r--src/backend/commands/view.c14
1 files changed, 7 insertions, 7 deletions
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;