Обсуждение: pgsql: Apply a simple solution to the problem of making

Поиск
Список
Период
Сортировка

pgsql: Apply a simple solution to the problem of making

От
tgl@postgresql.org (Tom Lane)
Дата:
Log Message:
-----------
Apply a simple solution to the problem of making INSERT/UPDATE/DELETE
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.

Modified Files:
--------------
    pgsql/doc/src/sgml:
        rules.sgml (r1.45 -> r1.46)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/rules.sgml.diff?r1=1.45&r2=1.46)
    pgsql/doc/src/sgml/ref:
        create_rule.sgml (r1.45 -> r1.46)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/create_rule.sgml.diff?r1=1.45&r2=1.46)
    pgsql/src/backend/rewrite:
        rewriteDefine.c (r1.112 -> r1.113)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/rewrite/rewriteDefine.c.diff?r1=1.112&r2=1.113)
        rewriteHandler.c (r1.165 -> r1.166)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/rewrite/rewriteHandler.c.diff?r1=1.165&r2=1.166)
    pgsql/src/test/regress/expected:
        returning.out (r1.2 -> r1.3)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/returning.out.diff?r1=1.2&r2=1.3)
    pgsql/src/test/regress/sql:
        returning.sql (r1.2 -> r1.3)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/returning.sql.diff?r1=1.2&r2=1.3)