Re: ERROR: unexpected chunk number 452 (expected 0) for toast value94674063 in pg_toast_56980977 - Mailing list pgsql-admin

From Jorge Torralba
Subject Re: ERROR: unexpected chunk number 452 (expected 0) for toast value94674063 in pg_toast_56980977
Date
Msg-id CACut7uSkZrpFHtDEq6UCoOd5fMpXDvmhzGSh=ZHJx86Ac=nOUg@mail.gmail.com
Whole thread Raw
In response to Re: ERROR: unexpected chunk number 452 (expected 0) for toast value94674063 in pg_toast_56980977  (Shreeyansh Dba <shreeyansh2014@gmail.com>)
List pgsql-admin
If the reindex does not work, You need to loop through the data and identify which rows are bad and delete them. 

Modify the following script to suit your needs and it should help you identify which rows are bad.

DO $f$
DECLARE
    baddata TEXT;
    badid INT;
BEGIN
FOR badid IN SELECT id FROM badtable LOOP
    BEGIN
        SELECT badcolumn
        INTO columndata
        FROM badtable where id = badid;
    EXCEPTION
        WHEN OTHERS THEN
            RAISE NOTICE 'Data for ID % is corrupt', badid;
            CONTINUE;
    END;
END LOOP;
END;
$f$


On Wed, Jul 18, 2018 at 9:01 AM, Shreeyansh Dba <shreeyansh2014@gmail.com> wrote:
Hi Naveen,

Normally we see the chunk errors comes due to the disk IO storage level issues and it leads towards the data corruption.

Try reindexing or vacuuming otherwise it may need a detailed analysis to resolve these chunk errors.



On Wed, Jul 18, 2018 at 9:15 PM, Naveen Kumar <naveenchowdaryon@gmail.com> wrote:
Hello Experts,

What could be the reason for bellow errors. Can one help me to fix this?

PostgreSQL Database: [~rptdb~] Data Backup Failed with PostgreSQL Error: [~pg_dump: Dumping the contents of table "document" failed: PQgetResult() failed.pg_dump: Error message from server: ERROR: unexpected chunk number 452 (expected 0) for toast value 94674063 in pg_toast_56980977pg_dump: The command was: COPY reports_extended.document (document_id, access_key, created_date, document_name, document_size, document_status, document_type, encryption_type, external_system_storage_id, external_system_storage_url, last_updated_date, md5_hash, source_system_name, storage_type, created_by, customer_org_id, content_type, tags, file, ownedby) TO stdout;~].

Thanks & Regards,

Naveen Kumar .M,
Sr. PostgreSQL Database Administrator,
Mobile: 7755929449.

My attitude will always be based on how you treat me. 




--
Thanks,

Jorge Torralba
----------------------------

Note: This communication may contain privileged or other confidential information. If you are not the intended recipient, please do not print, copy, retransmit, disseminate or otherwise use the information. Please indicate to the sender that you have received this email in error and delete the copy you received. Thank You.

pgsql-admin by date:

Previous
From: "Ghiurea, Isabella"
Date:
Subject: find objects stored on a specific tablespace
Next
From: "David G. Johnston"
Date:
Subject: Re: find objects stored on a specific tablespace