From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Can I assume there's only one _RETURN rule? |
Date: | 2006-08-18 02:53:04 |
Message-ID: | 2473.1155869584@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Another question. The patch does a lot of scanning of the range table
> searching for specific aliases for things -- usually for *NEW* or *OLD*,
> but also to get the entry for the view we are modifying, etc. This
> seems pretty fragile -- it breaks if I create a table named *OLD*, for
> example. Is this acceptable?
The rule stuff already depends on "*NEW*" and "*OLD*" being unique as
table aliases, though IIRC not as actual table names. Maybe it'd be
worth adding something to reject SELECT ... FROM foo "*NEW*" ...
> Is this a showstopper? I don't see any other way to walk the RT --
> unless I were to change the RTE node representation, I think.
The *NEW*/*OLD* stuff is pretty ugly, but it was there already for
many years, and now seems not the time to fix it.
However, I'm not sure you need to be depending on those textual names.
IIRC much of that code depends on rangetable indexes, instead --- look
for references to PRS2_OLD_VARNO and PRS2_NEW_VARNO. That's
considerably safer because the rule creation code can actually guarantee
what's in those rtable positions.
> Something else that's bothering me is that we mark *NEW* and *OLD* with
> rtekind RTE_RELATION, but a comment at the top of RangeTblEntry appears
> to say that they should be marked with RTE_SPECIAL.
I think they have to be RTE_RELATION because they serve in part as OID
references to the table-having-the-rule for dependency purposes. Again,
this is stuff to be cleaning up during development, not three weeks
after feature freeze.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2006-08-18 03:01:09 | Re: Can I assume there's only one _RETURN rule? |
Previous Message | Alvaro Herrera | 2006-08-18 02:39:14 | Re: Can I assume there's only one _RETURN rule? |