"Jonathan S. Katz" <jkatz(at)postgresql(dot)org> writes:
> Good catch. Do you have thoughts on how we can adjust the naming logic
> to handle cases like this?
I think it's perfectly fine that ruleutils decided to use different
aliases for the two different occurrences of "t1": the statement is
quite confusing as written. The problem probably is that
get_delete_query_def() has no idea that it's supposed to print the
adjusted alias just after "DELETE FROM tab". UPDATE likely has same
issue ... maybe INSERT too?
regards, tom lane