• Tom Lane's avatar
    Apply a simple solution to the problem of making INSERT/UPDATE/DELETE · 917bbebf
    Tom Lane authored
    RETURNING play nice with views/rules.  To wit, have the rule rewriter
    rewrite any RETURNING clause found in a rule to produce what the rule's
    triggering query asked for in its RETURNING clause, in particular drop
    the RETURNING clause if no RETURNING in the triggering query.  This
    leaves the responsibility for knowing how to produce the view's output
    columns on the rule author, without requiring any fundamental changes
    in rule semantics such as adding new rule event types would do.  The
    initial implementation constrains things to ensure that there is
    exactly one, unconditionally invoked RETURNING clause among the rules
    for an event --- later we might be able to relax that, but for a post
    feature freeze fix it seems better to minimize how much invention we do.
    Per gripe from Jaime Casanova.
    917bbebf
rewriteDefine.c 19.5 KB