pgsync syncs wrong data.
prithvihv opened this issue · 2 comments
prithvihv commented
I will try to make a full reproducable test case when i find time, but here's the issue im facing in my current infrastructure
Initially db1 and db2 have the same data, restored using pg_dump, pg_restore
here's the output log:
psql "db1"
psql (13.9, server 13.2 (Ubuntu 13.2-1.pgdg18.04+1))
Type "help" for help.
db1=> select id, "authKey" from publishers where "authKey" != id::varchar limit 1;
id | authKey
------+-----------
2389 | VJauqUSa2
(1 row)
db1=> \q
psql "db2"
psql (13.9, server 13.2 (Ubuntu 13.2-1.pgdg18.04+1))
Type "help" for help.
db2=> select id, "authKey" from publishers where "authKey" != id::varchar limit 1;
id | authKey
------+-----------
2389 | VJauqUSa2
(1 row)
db2=> \q
then we have a job:
pgsync -jobs 1 --config ./crons/pgsync.yml publisher_data
where ./crons/pgsync.yml
is:
# source database URL
# database URLs take the format of:
# postgres://user:password@host:port/dbname
#
# we recommend a command which outputs a database URL
# so sensitive information is not included in this file
#
# we *highly recommend* you use sslmode=verify-full when possible
# see https://ankane.org/postgres-sslmode-explained for more info
from: db1
# destination database URL
to: db2
to_safe: true
# exclude tables
# exclude:
# - table1
# - table2
# define groups
groups:
publisher_data:
- parentOrganizations
- publishers
# sync specific schemas
# schemas:
# - public
after running command:
^^>>> psql "db2"
psql (13.9, server 13.7 (Debian 13.7-1.pgdg110+1))
Type "help" for help.
db2=# select id, "authKey" from publishers where "authKey" != id::varchar limit 1;
id | authKey
----+---------
(0 rows)
looks like for somereason pgsync decided to write id's value into authKey
.
prithvihv commented
Happy to help with other details in my environment.
Using pgsync 0.7.2 on nixos
ankane commented
Hi @prithvihv, I'm not really sure how to reproduce. Please use the script in the new issue template when you have a chance.