I wrote:
> ... I'm not even real sure what
> all the issues would be, but I'm pretty sure that subplans are just the
> tip of the iceberg.
Another issue is that ruleutils responds to column aliasing, as indeed
it must to generate correct output for rules:
regression=# explain select * from tenk1 a where a.unique1 = 42; QUERY PLAN
-------------------------------------------------------------------------------Index Scan using tenk1_unique1 on tenk1
a (cost=0.00..8.27 rows=1 width=244) Index Cond: (unique1 = 42)
(2 rows)
regression=# explain select * from tenk1 a(foo) where a.foo = 42; QUERY PLAN
-------------------------------------------------------------------------------Index Scan using tenk1_unique1 on tenk1
a (cost=0.00..8.27 rows=1 width=244) Index Cond: (foo = 42)
(2 rows)
This would be a bit of a problem for dblink or similar functions, which
would have no way at all to know how the column names that they are
dealing in got renamed.
regards, tom lane