|
|
|
@ -3,7 +3,7 @@ |
|
|
|
|
* back to source text |
|
|
|
|
* |
|
|
|
|
* IDENTIFICATION |
|
|
|
|
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.167 2004/05/26 04:41:38 neilc Exp $ |
|
|
|
|
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.168 2004/05/26 19:30:12 tgl Exp $ |
|
|
|
|
* |
|
|
|
|
* This software is copyrighted by Jan Wieck - Hamburg. |
|
|
|
|
* |
|
|
|
@ -2274,17 +2274,14 @@ static void |
|
|
|
|
get_names_for_var(Var *var, deparse_context *context, |
|
|
|
|
char **schemaname, char **refname, char **attname) |
|
|
|
|
{ |
|
|
|
|
ListCell *nslist_item = list_head(context->namespaces); |
|
|
|
|
int sup = var->varlevelsup; |
|
|
|
|
deparse_namespace *dpns; |
|
|
|
|
RangeTblEntry *rte; |
|
|
|
|
|
|
|
|
|
/* Find appropriate nesting depth */ |
|
|
|
|
while (sup-- > 0 && nslist_item != NULL) |
|
|
|
|
nslist_item = lnext(nslist_item); |
|
|
|
|
if (nslist_item == NULL) |
|
|
|
|
if (var->varlevelsup >= list_length(context->namespaces)) |
|
|
|
|
elog(ERROR, "bogus varlevelsup: %d", var->varlevelsup); |
|
|
|
|
dpns = (deparse_namespace *) lfirst(nslist_item); |
|
|
|
|
dpns = (deparse_namespace *) list_nth(context->namespaces, |
|
|
|
|
var->varlevelsup); |
|
|
|
|
|
|
|
|
|
/* Find the relevant RTE */ |
|
|
|
|
if (var->varno >= 1 && var->varno <= length(dpns->rtable)) |
|
|
|
|