diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-08-19 20:57:41 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-08-19 20:57:41 +0000 |
| commit | bbd6eb5b958ef38f786089fd4a03d650d4b7220e (patch) | |
| tree | 3dbc25578ccd347b586018f6b8a6d8d6baa84ac7 /src/backend/catalog | |
| parent | 040450beef4f3fdafaa9e20dbb0ee3e00c5856ba (diff) | |
| download | postgresql-bbd6eb5b958ef38f786089fd4a03d650d4b7220e.tar.gz | |
Repair some issues with column aliases and RowExpr construction in the
presence of dropped columns. Document the already-presumed fact that
eref aliases in relation RTEs are supposed to have entries for dropped
columns; cause the user alias structs to have such entries too, so that
there's always a one-to-one mapping to the underlying physical attnums.
Adjust expandRTE() and related code to handle the case where a column
that is part of a JOIN has been dropped. Generalize expandRTE()'s API
so that it can be used in a couple of places that formerly rolled their
own implementation of the same logic. Fix ruleutils.c to suppress
display of aliases for columns that were dropped since the rule was made.
Diffstat (limited to 'src/backend/catalog')
| -rw-r--r-- | src/backend/catalog/dependency.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 9d4e1c6a5c..59c3151cdf 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.36 2004/05/26 04:41:06 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.37 2004/08/19 20:57:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -970,10 +970,15 @@ find_expr_references_walker(Node *node, if (var->varno <= 0 || var->varno > list_length(rtable)) elog(ERROR, "invalid varno %d", var->varno); rte = rt_fetch(var->varno, rtable); + /* + * A whole-row Var references no specific columns, so adds no new + * dependency. + */ + if (var->varattno == InvalidAttrNumber) + return false; if (rte->rtekind == RTE_RELATION) { /* If it's a plain relation, reference this column */ - /* NB: this code works for whole-row Var with attno 0, too */ add_object_address(OCLASS_CLASS, rte->relid, var->varattno, &context->addrs); } |
