pgrewrite: was Re: [HACKERS] pg_user problem - Mailing list pgsql-hackers
| From | Bruce Momjian |
|---|---|
| Subject | pgrewrite: was Re: [HACKERS] pg_user problem |
| Date | |
| Msg-id | 199809111638.MAA01426@candle.pha.pa.us Whole thread Raw |
| In response to | pg_user problem (Tatsuo Ishii <t-ishii@sra.co.jp>) |
| Responses |
Re: pgrewrite: was Re: [HACKERS] pg_user problem
|
| List | 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@candle.pha.pa.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)
pgsql-hackers by date: