Re: [ADMIN] Help: unfixable/undead error - missing chunk number 0 for toast value 413511 in pg_toast_25477

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [ADMIN] Help: unfixable/undead error - missing chunk number 0 for toast value 413511 in pg_toast_25477
Дата
Msg-id 4224.1485446583@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [ADMIN] Help: unfixable/undead error - missing chunk number 0for toast value 413511 in pg_toast_25477  (Maris Jansons <maris@lailio.net>)
Ответы Re: [ADMIN] Help: unfixable/undead error - missing chunk number 0for toast value 413511 in pg_toast_25477  (Maris Jansons <maris@lailio.net>)
Список pgsql-admin
Maris Jansons <maris@lailio.net> writes:
> I have identified the problematic column, in my case it is api_response, my version of script:
> DO $f$
> DECLARE
> baddata TEXT;
> badid INT;
> BEGIN
> FOR badid IN SELECT id FROM api_logs LOOP
> BEGIN
> SELECT api_response
> INTO baddata
> FROM api_logs where id = badid;
> EXCEPTION
> WHEN OTHERS THEN
> RAISE NOTICE 'Data for ID % is corrupt', badid;
> CONTINUE;
> END;
> END LOOP;
> END;
> $f$
> However this script finishes without errors, but if I run simple
>> select api_response from api_logs;
> I get:
> ERROR: missing chunk number 0 for toast value 413511 in pg_toast_25477

> Maybe I have messed something up in the script?

Oh ... what is happening, I think, is that the toast pointers are getting
stored into the "baddata" local variable as-is.  The problem would only
get detected if the system has to fetch the toasted value, and this code
doesn't make it do so.

You could do something that requires fetching the value, perhaps

SELECT api_response || '' INTO baddata ...

            regards, tom lane


В списке pgsql-admin по дате отправления:

Предыдущее
От: Maris Jansons
Дата:
Сообщение: Re: [ADMIN] Help: unfixable/undead error - missing chunk number 0for toast value 413511 in pg_toast_25477
Следующее
От: Maris Jansons
Дата:
Сообщение: Re: [ADMIN] Help: unfixable/undead error - missing chunk number 0for toast value 413511 in pg_toast_25477