Re: [PATCH] session_replication_role = replica with TRUNCATE

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Re: [PATCH] session_replication_role = replica with TRUNCATE
Дата
Msg-id 2e689636-51cd-aa19-c7a2-435051fbc9cd@2ndquadrant.com
обсуждение исходный текст
Ответ на [PATCH] session_replication_role = replica with TRUNCATE  (Marco Nenciarini <marco.nenciarini@2ndquadrant.it>)
Ответы Re: [PATCH] session_replication_role = replica with TRUNCATE  (Craig Ringer <craig@2ndquadrant.com>)
Re: [PATCH] session_replication_role = replica with TRUNCATE  (Marco Nenciarini <marco.nenciarini@2ndquadrant.it>)
Список pgsql-hackers
Hi,

On 29/12/17 13:01, Marco Nenciarini wrote:
> Hi,
> 
> The current behavior of session_replication_role = replica with TRUNCATE
> is not the same of with the other commands.
> It does not check FKs for INSERT/UPDATE/DELETE but it does for TRUNCATE,
> so one cannot execute TRUNCATE on a table when it is possible to DELETE
> from table without WHERE clause.
> 

Yes please, I never understood why 'DELETE FROM foo;' works fine with
'session_replication_role = replica' and FKs while 'TRUNCATE foo;' would
throw error.

> I'm attaching a simple patch to make TRUNCATE match behavior of DELETE
> for session_replication_role = replica.
> 

May be worth documenting that the session_replication_role also affects
TRUNCATE's interaction with FKs in config.sgml.

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


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

Предыдущее
От: David Steele
Дата:
Сообщение: Re: Basebackups reported as idle
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Add hint about replication slots when nearing wraparound