对 jsonB 列类型使用 pgLogical 行过滤器
Using pgLogical row filter for jsonB column type
我正在尝试复制一个包含 jsonB 列的 table。我想对 select 仅使用我需要的行进行行过滤。如何为 jsonB 定义行过滤器?
Table人:
id serial,
name TEXT NOT NULL,
details JSONB NOT NULL,
modified_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (name));
示例数据:
id | name | details | modified_at
----+---------+-----------------+-------------------------------
1 | person1 | {"city": "nyc"} | 2021-05-17 06:05:55.735086+00
2 | person2 | {"city": "SF"} | 2021-05-17 06:06:30.028065+00
我尝试了以下方法,但它们不起作用:
SELECT pglogical.replication_set_add_table(set_name:= 'replicate1', relation := 'person', row_filter:= details->>'city' = 'nyc');
我试过的另一个选项:
SELECT pglogical.replication_set_add_table(set_name:= 'replicate1', relation := 'person', row_filter:= "details->>'city' = 'nyc'");
我正在尝试复制一个包含 jsonB 列的 table。我想对 select 仅使用我需要的行进行行过滤。如何为 jsonB 定义行过滤器?
Table人:
id serial,
name TEXT NOT NULL,
details JSONB NOT NULL,
modified_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
PRIMARY KEY (name));
示例数据:
id | name | details | modified_at
----+---------+-----------------+-------------------------------
1 | person1 | {"city": "nyc"} | 2021-05-17 06:05:55.735086+00
2 | person2 | {"city": "SF"} | 2021-05-17 06:06:30.028065+00
我尝试了以下方法,但它们不起作用:
SELECT pglogical.replication_set_add_table(set_name:= 'replicate1', relation := 'person', row_filter:= details->>'city' = 'nyc');
我试过的另一个选项:
SELECT pglogical.replication_set_add_table(set_name:= 'replicate1', relation := 'person', row_filter:= "details->>'city' = 'nyc'");