pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedConditional column filtering with pglogical replication
3+ messages / 2 participants
[nested] [flat]
* Conditional column filtering with pglogical replication
@ 2020-10-23 13:34 PALAYRET Jacques <jacques.palayret@meteo.fr>
0 siblings, 1 reply; 3+ messages in thread
From: PALAYRET Jacques @ 2020-10-23 13:34 UTC (permalink / raw)
To: pgsql-general
Hello,
With PgLogical extension, I have tested the possibility of column filtering (columns) and row filtering (row_filter).
But is there a way to do a conditional column filtering ?
I mean a way to filter a column based on a predicate, with pglogical (so the filtered values won’t arrive on subscribers).
For example, with a replicated table t(a integer as Primary Key, b numeric, c integer, d text), I would like to filter the column b when c between 10 and 20.
Regards
----- Météo-France -----
PALAYRET JACQUES
DCSC/MBD
jacques.palayret@meteo.fr
Fixe : +33 561078319
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Conditional column filtering with pglogical replication
@ 2020-10-23 14:23 Fabrízio de Royes Mello <fabrizio@timbira.com.br>
parent: PALAYRET Jacques <jacques.palayret@meteo.fr>
0 siblings, 1 reply; 3+ messages in thread
From: Fabrízio de Royes Mello @ 2020-10-23 14:23 UTC (permalink / raw)
To: PALAYRET Jacques <jacques.palayret@meteo.fr>; +Cc: pgsql-general
Em sex., 23 de out. de 2020 às 10:35, PALAYRET Jacques <
jacques.palayret@meteo.fr> escreveu:
>
> With PgLogical extension, I have tested the possibility of column
filtering (columns) and row filtering (row_filter).
> But is there a way to do a conditional column filtering ?
> I mean a way to filter a column based on a predicate, with pglogical (so
the filtered values won’t arrive on subscribers).
> For example, with a replicated table t(a integer as Primary Key, b
numeric, c integer, d text), I would like to filter the column b when c
between 10 and 20.
>
Hello,
According to the documentation [1] the row_filter is a normal PostgreSQL
expression with the same limitations of CHECK constraints, so you can do
something like: row_filter := 'c between 10 and 20 and b = ?'
Regards,
[1] https://github.com/2ndQuadrant/pglogical#row-filtering
--
Fabrízio de Royes Mello Timbira - http://www.timbira.com.br/
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Conditional column filtering with pglogical replication
@ 2020-10-23 15:14 PALAYRET Jacques <jacques.palayret@meteo.fr>
parent: Fabrízio de Royes Mello <fabrizio@timbira.com.br>
0 siblings, 0 replies; 3+ messages in thread
From: PALAYRET Jacques @ 2020-10-23 15:14 UTC (permalink / raw)
To: pgsql-general
The " row_filter " filters the rows and I don’t want to filter the row but only one (or several) column(s).
Actually, I want a column value on the provider to be filtered on subcribers when replicating.
For example, on provider :
a | b | c | d
-----+------+----+------
123 | 45.6 | 15 | abc
111 | 55.5 | 66 | def
on subscriber :
a | b | c | d
-----+------+----+------
123 | 45.6 | 15 | abc
111 | | 66 | def
-> b NULL on subscriber but the others columns are replicated.
De: "Fabrízio de Royes Mello" <fabrizio@timbira.com.br>
À: "PALAYRET Jacques" <jacques.palayret@meteo.fr>
Cc: "Postgres General" <pgsql-general@postgresql.org>
Envoyé: Vendredi 23 Octobre 2020 16:23:19
Objet: Re: Conditional column filtering with pglogical replication
Em sex., 23 de out. de 2020 às 10:35, PALAYRET Jacques < [ mailto:jacques.palayret@meteo.fr | jacques.palayret@meteo.fr ] > escreveu:
>
> With PgLogical extension, I have tested the possibility of column filtering (columns) and row filtering (row_filter).
> But is there a way to do a conditional column filtering ?
> I mean a way to filter a column based on a predicate, with pglogical (so the filtered values won’t arrive on subscribers).
> For example, with a replicated table t(a integer as Primary Key, b numeric, c integer, d text), I would like to filter the column b when c between 10 and 20.
>
Hello,
According to the documentation [1] the row_filter is a normal PostgreSQL expression with the same limitations of CHECK constraints, so you can do something like: row_filter := 'c between 10 and 20 and b = ?'
Regards,
[1] [ https://github.com/2ndQuadrant/pglogical#row-filtering | https://github.com/2ndQuadrant/pglogical#row-filtering ]
--
Fabrízio de Royes Mello Timbira - [ http://www.timbira.com.br/ | http://www.timbira.com.br/ ]
PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-10-23 15:14 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23 13:34 Conditional column filtering with pglogical replication PALAYRET Jacques <jacques.palayret@meteo.fr>
2020-10-23 14:23 ` Fabrízio de Royes Mello <fabrizio@timbira.com.br>
2020-10-23 15:14 ` PALAYRET Jacques <jacques.palayret@meteo.fr>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox