From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | t-ishii(at)sra(dot)co(dot)jp |
Cc: | pgsql-hackers(at)postgreSQL(dot)org, t-ishii(at)srapc451(dot)sra(dot)co(dot)jp, wieck(at)sapserv(dot)debis(dot)de |
Subject: | pgrewrite: was Re: [HACKERS] pg_user problem |
Date: | 1998-09-11 16:38:54 |
Message-ID: | 199809111638.MAA01426@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Nice job Tatsuo.
Looks like electric fence was properly pointing to the problem. I am
going to get electric fence working on my machine here.
I have modified your patch, and I would like Jan to confirm the fix.
Instead of only processing target list Var's, I am doing Var's as you
suggested, and non-Vars by re-calling the function to process the
non-var node. This appears to be more in keeping with the rest of the
function. I am committing this patch.
Let me know if you or Jan see any problems with this.
> Hi, please apply following patches to rewrite/rewriteManip.c.
> This seems to fix the "pg_user problem." (I am not very familiar
> with the rule/rewrite area, so my understanding may be wrong)
> The original code sets varlevelsup even if the node is not
> variable node. This assumption is not always correct, for example
> with the password column of pg_user view.
> Anyway, with the patch the select_view test is now ok on my LiuxPPC
> box.
Index: src/backend/rewrite/rewriteManip.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v
retrieving revision 1.17
diff -c -r1.17 rewriteManip.c
*** rewriteManip.c 1998/09/01 04:31:35 1.17
--- rewriteManip.c 1998/09/11 16:16:20
***************
*** 614,622 ****
var->varattno));
if (n == NULL)
*nodePtr = make_null(((Var *) node)->vartype);
-
else
!
/*
* This is a hack: The varlevelsup of the orignal
* variable and the new one should be the same.
--- 614,621 ----
var->varattno));
if (n == NULL)
*nodePtr = make_null(((Var *) node)->vartype);
else
! {
/*
* This is a hack: The varlevelsup of the orignal
* variable and the new one should be the same.
***************
*** 628,639 ****
* before! (Maybe this will cause troubles with
* some sophisticated queries on views?)
*/
- {
if (this_varlevelsup > 0)
*nodePtr = copyObject(n);
else
*nodePtr = n;
! ((Var *) *nodePtr)->varlevelsup = this_varlevelsup;
}
*modified = TRUE;
}
--- 627,642 ----
* before! (Maybe this will cause troubles with
* some sophisticated queries on views?)
*/
if (this_varlevelsup > 0)
*nodePtr = copyObject(n);
else
*nodePtr = n;
!
! if (nodeTag(nodePtr) == T_Var)
! ((Var *) *nodePtr)->varlevelsup = this_varlevelsup;
! else
! nodeHandleViewRule(&n, rtable, targetlist,
! rt_index, modified, sublevels_up);
}
*modified = TRUE;
}
--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1998-09-11 16:41:01 | Re: [HACKERS] Missing headers Windows NT port |
Previous Message | Thomas G. Lockhart | 1998-09-11 16:17:12 | Re: [HACKERS] pg_user problem |