On Thu, Nov 17, 2022 at 8:37 AM Fred Williams <fredmw7@gmail.com> wrote:
PostgreSQL version 12.2
Problem
I am unable to delete or edit a specific range of table rows (I'll call them corrupted rows) for a specific primary key. If I truncate the entire table, the corrupted rows remain. In the corrupted rows, I can successfully update non-primary key fields, but not primary-key fields.
Miscellaneous
The problem does not occur on a test server using the same exact table.
If I rename the table, I can remove the corrupted rows and/or update the primary keys (such as changing the DateTime). However, when I rename it back, the corrupted rows reappear!
Some suggestions of things you can do (not mutually exclusive):
Update PostgreSQL to a supported version, v14.6
Post the output of running: \d+ "NCAASchedule"
Rename the table to something else. Create a new table with this name. Populate it with the data you want it to have. Recreate objects depending on the old table to instead depend on the newly created one. Drop the problematic table. (If you aren't married to the table name, you might consider creating the new table with a new name so that nothing existing, internal or external, is capable of referencing it).
I seriously doubt this is a PostgreSQL bug; some trigger or external process messing with the table seems much more plausible.