Dean Rasheed <[email protected]> writes:
> I think just dropping the Asserts is the better solution, because
> showing "Output: n.a" in the EXPLAIN output is likely to lead to
> confusion, since there was no relation with alias "n" in the
> triggering query, and "n" isn't mentioned anywhere else in the EXPLAIN
> output. The user would have to lookup the rule definition to figure
> out what "n" means.

But wait a minute: there's still something pretty strange
going on here.  In the first place, Ayush's test case doesn't
crash if the outer query doesn't try to use alias "new" for v:

EXPLAIN (VERBOSE, COSTS OFF)
    INSERT INTO v AS foo VALUES (1) RETURNING *;
     QUERY PLAN     
--------------------
 Insert on public.t
   Output: new.a
   ->  Result
         Output: 1
(4 rows)

In the second place, where did "new" come from here?  If it came out
of the rule, why isn't it "n"?  Seems like we're exposing details of
the rule anyway, but inconsistently.

                        regards, tom lane


Reply via email to