Re: [BUGS] BUG #14771: "Logical decoding" does not cover the impactof "TRUNCATE TABLE" command

Поиск
Список
Период
Сортировка
От Euler Taveira
Тема Re: [BUGS] BUG #14771: "Logical decoding" does not cover the impactof "TRUNCATE TABLE" command
Дата
Msg-id CAHE3wgiZArC5kPNt3CVRGYA7H5O_WnvjosbFnTxrp+aYCTxtxg@mail.gmail.com
обсуждение исходный текст
Ответ на [BUGS] BUG #14771: "Logical decoding" does not cover the impact of "TRUNCATETABLE" command  (hillel.eilat@attunity.com)
Ответы Re: [BUGS] BUG #14771: "Logical decoding" does not cover the impactof "TRUNCATE TABLE" command  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-bugs
2017-08-07 9:20 GMT-03:00  <hillel.eilat@attunity.com>:
> PostgreSQL version: 9.4.4
> Operating system:   Windows 7
> Description:
>
I advise you to use a recent version (10?) because logical decoding
has been improved in the last years.

> I work on a mission of synchronizing data between PostgreSQL database and a
> "foreign" target database of choice.
>
This is not a bug.

> From "Logical Decoding" perspective - "TRUNCATE TABLE" is logically
> equivalent to "DELETE FROM TABLE".
> Both affect the contents of the PostgreSQL database identically.
> However - "DELETE FROM TABLE" will be reflected at the target database
> properly - as expected - while "TRUNCATE" will NOT!!.
>
TRUNCATE is a DDL command. DDL commands are not supported (yet) by
logical decoding.

> "TRUNCATE" stands for a case where change in data contents at PostgreSQL are
> not handled by "Logical Decoding", hence synchronization is not achieved.
> Did I miss something?
> Is it the only case?
> How can one cope with this deficiency?
>
You have at least 4 options:

(i) block TRUNCATE statement (via REVOKE);
(ii) write a plugin using ProcessUtility_hook to block TRUNCATE statement;
(iii) write a plugin using ProcessUtility_hook to convert it into
DELETE FROM table;
(iv) modify postgres to support TRUNCATE (logical) replication.


--   Euler Taveira                                   Timbira -
http://www.timbira.com.br/  PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: hillel.eilat@attunity.com
Дата:
Сообщение: [BUGS] BUG #14771: "Logical decoding" does not cover the impact of "TRUNCATETABLE" command
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] Error of insert Foreign table with postgres_fdw