From: | Jayadevan M <maymala(dot)jayadevan(at)gmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | String comparison fails for some cases after migration |
Date: | 2021-10-27 06:11:41 |
Message-ID: | CAFS1N4ip9BQqyNXcHB1Z=nO50g-U9jQarEYQ-AOUzobYADY63A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello all,
We moved our PostgreSQL database from one hosting provider to another using
pgbackrest. In the new environment, some comparison operations were
failing. The issue was fixed by running an update. But I am trying to find
out what would have happened.
select * from accounts where email = 'someemail(at)gmail(dot)com'; -- failed for
some email ids even though there were records.
select * from accounts where lower(trim(email)) <> email; -- fetched no
records.
select * from accounts where email::bytea = 'someemail(at)gmail(dot)com'::bytea; -
worked for those records where comparison was failing.
update accounts set email = trim(lower(email)); -- fixed the issue.
Source database was PG 13.2, target 13.3.
Any suggestions will be appreciated - not sure if other tables/columns are
affected.
Best Regards,
Jayadevan
From | Date | Subject | |
---|---|---|---|
Next Message | Julien Rouhaud | 2021-10-27 06:19:14 | Re: String comparison fails for some cases after migration |
Previous Message | Guyren Howe | 2021-10-27 04:33:03 | Best options for tracking history of data? |