Re: Server table rows permanently fixed (cannot be deleted or truncated) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Server table rows permanently fixed (cannot be deleted or truncated)
Date
Msg-id 1834626.1668701055@sss.pgh.pa.us
Whole thread Raw
In response to Server table rows permanently fixed (cannot be deleted or truncated)  (Fred Williams <fredmw7@gmail.com>)
List pgsql-bugs
Fred Williams <fredmw7@gmail.com> writes:
> 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*

>    1. The problem does not occur on a test server using the same exact
>    table.
>    2. 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!

TBH, I'm suspecting pilot error.  I wonder whether you have another
table by the same name in a different schema, which is the one
containing the "corrupted" rows, and after you rename this table
out of the way you're unintentionally accessing the other one.

That theory doesn't explain the rows surviving TRUNCATE, but
maybe inheritance could --- IIRC, TRUNCATE will not touch child
tables.  So maybe the alias table is also an inheritance child
of the one you are modifying?

This command in psql would clarify much:

postgres=# \d+ *."NCAASchedule"

            regards, tom lane



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Server table rows permanently fixed (cannot be deleted or truncated)
Next
From: Andres Freund
Date:
Subject: Re: WAL segments removed from primary despite the fact that logical replication slot needs it.