Re: pageinspect: add tuple_data_record()

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pageinspect: add tuple_data_record()
Дата
Msg-id 20181017172051.pz5cmyozq6jva346@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: pageinspect: add tuple_data_record()  (James Coleman <jtc331@gmail.com>)
Ответы Re: pageinspect: add tuple_data_record()
Список pgsql-hackers
Hi,

On 2018-10-17 13:14:17 -0400, James Coleman wrote:
> > It's far from only toast that could be problematic here.
> >
> 
> Do you have an example in mind? Wouldn’t the tuples have to be corrupted in
> some way to have problems with being interpreted as a datum? Or are you
> thinking very old tuples with a radically different structure to be causing
> the problem?

There's plenty ways it can go horribly wrong. Let's start with something
simple:

BEGIN;
ALTER TABLE ... ADD COLUMN blarg INT;
INSERT ... (blag) VALUES (132467890);
ROLLBACK;

ALTER TABLE ... ADD COLUMN blarg TEXT;

If you now read the table with your function you'll see a dead row that
will re-interpret a int datum as a text datum. Which in all likelyhood
will crash the server.

And yes, it's more likely to break with your patch, but I think the
current *split* function is dangerous too, and shouldn't have been added
without *A LOT* more attention to issues like this.

Greetings,

Andres Freund


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

Предыдущее
От: James Coleman
Дата:
Сообщение: Re: pageinspect: add tuple_data_record()
Следующее
От: Larry Rosenman
Дата:
Сообщение: Peripatus/failures