I have a problem with logical replication could not identify an equality operator for type json
. I found a solution where they say to replace json fields with jsonb to solve this problem. I checked json and jsonb operators, and saw that jsonb doesn't have any operators that json doesn't have. I mean, if jsonb extends the capabilities of json, then would it be safe to make an alert and have the field type from json to jsonb?
Logs on replica:
LOG: logical replication table synchronization worker for subscription "mysub", table "order_f" has started
ERROR: could not identify an equality operator for type json
background worker "logical replication worker" (PID 45) exited with exit code 1
primary instance version - PostgreSQL 14.4 on aarch64-unknown-linux-gnu, compiled by gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6), 64-bit (on AWS RDS)
replica instance version - PostgreSQL 14.4 (Debian 14.4-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit (self hosted in docker)
It is safe, yon can directly convert it.
CREATE tABLE t (j json)
ALTER TABLE t ALTER COLUMN j TYPE jsonb USING j::jsonb;
ALTER TABLE