Re: [PATCH] session_replication_role = replica with TRUNCATE

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: [PATCH] session_replication_role = replica with TRUNCATE
Дата
Msg-id CAMsr+YEJSPzrRjVK0ewAaraGcQWpBAfzxv0zudctBiTQx5hnGw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] session_replication_role = replica with TRUNCATE  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
Ответы Re: [PATCH] session_replication_role = replica with TRUNCATE  (Marco Nenciarini <marco.nenciarini@2ndquadrant.it>)
Список pgsql-hackers
On 30 December 2017 at 03:32, Petr Jelinek <petr.jelinek@2ndquadrant.com> wrote:
On 29/12/17 16:53, Marco Nenciarini wrote:
> Il 29/12/17 15:14, Petr Jelinek ha scritto:
>>
>> May be worth documenting that the session_replication_role also affects
>> TRUNCATE's interaction with FKs in config.sgml.
>>
>
> The current documentation of session_replication_role GUC is:
>
>     Controls firing of replication-related triggers and rules for the
>     current session. Setting this variable requires superuser privilege
>     and results in discarding any previously cached query plans.
>     Possible values are origin (the default), replica and local.
>     See ALTER TABLE for more information.
>
> It doesn't speak about foreign keys or referential integrity, but only
> about triggers and rules. I don't think that it's worth to add a special
> case for truncate, unless we want to expand/rewrite the documentation to
> specify all the effects in the details.
>

The effects on foreign keys is implied by the fact that for DML it's
implemented using triggers, but that's not true for TRUNCATE. In any
case it does not hurt to mention the FKs explicitly rather than
implicitly here.

Yeah. I'd argue that's an oversight in the current docs that "can cause FK violations" isn't mentioned. That's kind of important, and FKs being triggers is implementation detail we shouldn't be relying on users to know. 

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: CONSTANT/NOT NULL/initializer properties for plpgsql record variables
Следующее
От: Andrey Borodin
Дата:
Сообщение: Re: New gist vacuum.