Selecting a specific single row showing different result in PostgreSQL which is very strange. There is a table named Employee. When I search like " SELECT UserId FROM Employee WHERE UserId='3123'" it shows another results as an output. Its output is like "3135". How UserId could be different?

I am using 3-node pgpool DB cluster in asynchronous replication. Why does this happen? How can I identify that mismatch? Is there any relation between them?

enter image description here

  • 1
    Is userid a string data type? Anyway, the only explanation that comes to my mind is data corruption. Commented Sep 7, 2023 at 21:11
  • Yes, string type Commented Sep 8, 2023 at 4:56
  • I am also thinking about data corruption. Even when trying to backup, at the middle of the backup it exits with an error like "null value in column id which violet the null constraint". This shows a few row is null. Now how can I recover those data? Actually, in the data, there is no null value available but in the backup, it shows a null value in a few rows. I don't understand why in the middle of the backup it shows a few rows' value is null. Now how can I backup? Commented Sep 8, 2023 at 5:27
  • 1
    If you have a corrupted database, you don't need to backup, you need to restore your last good backup. Commented Sep 8, 2023 at 6:57
  • Unable to restore from previous backup, now show this error at pg_dump "pg_dump: error: Error message from server: ERROR: invalid memory alloc request size 18446744073709551613" Commented Sep 9, 2023 at 17:40


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.