pgsql: Improve the handling of SET CONSTRAINTS commands by having them

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Improve the handling of SET CONSTRAINTS commands by having them
Дата
Msg-id 20100117225624.2F4F07541B9@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
Improve the handling of SET CONSTRAINTS commands by having them search
pg_constraint before searching pg_trigger.  This allows saner handling of
corner cases; in particular we now say "constraint is not deferrable"
rather than "constraint does not exist" when the command is applied to
a constraint that's inherently non-deferrable.  Per a gripe several months
ago from hubert depesz lubaczewski.

To make this work without breaking user-defined constraint triggers,
we have to add entries for them to pg_constraint.  However, in return
we can remove the pgconstrname column from pg_constraint, which represents
a fairly sizable space savings.  I also replaced the tgisconstraint column
with tgisinternal; the old meaning of tgisconstraint can now be had by
testing for nonzero tgconstraint, while there is no other way to get
the old meaning of nonzero tgconstraint, namely that the trigger was
internally generated rather than being user-created.

In passing, fix an old misstatement in the docs and comments, namely that
pg_trigger.tgdeferrable is exactly redundant with pg_constraint.condeferrable.
Actually, we mark RI action triggers as nondeferrable even when they belong to
a nominally deferrable FK constraint.  The SET CONSTRAINTS code now relies on
that instead of hard-coding a list of exception OIDs.

Modified Files:
--------------
    pgsql/doc/src/sgml:
        catalogs.sgml (r2.217 -> r2.218)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/catalogs.sgml?r1=2.217&r2=2.218)
        trigger.sgml (r1.61 -> r1.62)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/trigger.sgml?r1=1.61&r2=1.62)
    pgsql/src/backend/catalog:
        index.c (r1.329 -> r1.330)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/index.c?r1=1.329&r2=1.330)
        information_schema.sql (r1.63 -> r1.64)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/catalog/information_schema.sql?r1=1.63&r2=1.64)
    pgsql/src/backend/commands:
        tablecmds.c (r1.315 -> r1.316)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.315&r2=1.316)
        trigger.c (r1.258 -> r1.259)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/trigger.c?r1=1.258&r2=1.259)
    pgsql/src/backend/tcop:
        utility.c (r1.329 -> r1.330)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/utility.c?r1=1.329&r2=1.330)
    pgsql/src/backend/utils/adt:
        ruleutils.c (r1.318 -> r1.319)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/ruleutils.c?r1=1.318&r2=1.319)
    pgsql/src/bin/pg_dump:
        pg_dump.c (r1.566 -> r1.567)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/pg_dump/pg_dump.c?r1=1.566&r2=1.567)
    pgsql/src/bin/psql:
        describe.c (r1.233 -> r1.234)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/bin/psql/describe.c?r1=1.233&r2=1.234)
    pgsql/src/include/catalog:
        catversion.h (r1.573 -> r1.574)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h?r1=1.573&r2=1.574)
        indexing.h (r1.115 -> r1.116)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/indexing.h?r1=1.115&r2=1.116)
        pg_constraint.h (r1.36 -> r1.37)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_constraint.h?r1=1.36&r2=1.37)
        pg_trigger.h (r1.38 -> r1.39)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_trigger.h?r1=1.38&r2=1.39)
    pgsql/src/include/commands:
        trigger.h (r1.79 -> r1.80)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/trigger.h?r1=1.79&r2=1.80)
    pgsql/src/include/nodes:
        parsenodes.h (r1.424 -> r1.425)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/parsenodes.h?r1=1.424&r2=1.425)
    pgsql/src/include/utils:
        rel.h (r1.119 -> r1.120)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/rel.h?r1=1.119&r2=1.120)

В списке pgsql-committers по дате отправления:

Предыдущее
От: mha@postgresql.org (Magnus Hagander)
Дата:
Сообщение: pgsql: Add include directory for dblink to find fmgroids.h on VS2008
Следующее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Update SET CONSTRAINTS reference page --- it failed to mention