Patch: Pass IndexInfo correctly to aminsert for indexes on TOAST

Поиск
Список
Период
Сортировка
От Ahuja, Nitin
Тема Patch: Pass IndexInfo correctly to aminsert for indexes on TOAST
Дата
Msg-id 15A0E2BC-6CA5-4AE9-9454-41DDE80A1265@amazon.com
обсуждение исходный текст
Ответы Re: Patch: Pass IndexInfo correctly to aminsert for indexes on TOAST
Список pgsql-hackers

Hi,

I wanted to submit the below patch.

Patch Description
Currently, while saving the TOAST entry the call to index access method insert (aminsert) passed IndexInfo attribute as NULL. IndexInfo parameter was introduced in Postgres 10 for the aminsert method to allow caching data across aminsert calls within a single SQL statement. The IndexInfo is passed correctly for regular tuple insertion but not for TOAST entries. This currently prohibits aminsert method to be able to use IndexInfo for TOAST entries.

This patch correctly passes the built IndexInfo to aminsert for TOAST entries.

 

Context Diff for Patch Submission

 

*** postgres_patch/postgres/src/backend/access/heap/tuptoaster.c      2018-02-18 11:54:02.000000000 -0800

--- postgres/postgres/src/backend/access/heap/tuptoaster.c      2018-02-18 12:14:07.000000000 -0800

***************

*** 43,49 ****

  #include "utils/snapmgr.h"

  #include "utils/typcache.h"

  #include "utils/tqual.h"

- #include "catalog/index.h"

 

 

  #undef TOAST_DEBUG

--- 43,48 ----

***************

*** 1671,1677 ****

                                 * Create the index entry.  We cheat a little here by not using

                                 * FormIndexDatum: this relies on the knowledge that the index columns

                                 * are the same as the initial columns of the table for all the

!                               * indexes.

                                 *

                                 * Note also that there had better not be any user-created index on

                                 * the TOAST table, since we don't bother to update anything else.

--- 1670,1678 ----

                                 * Create the index entry.  We cheat a little here by not using

                                 * FormIndexDatum: this relies on the knowledge that the index columns

                                 * are the same as the initial columns of the table for all the

!                               * indexes.  We also cheat by not providing an IndexInfo: this is okay

!                               * for now because btree doesn't need one, but we might have to be

!                               * more honest someday.

                                 *

                                 * Note also that there had better not be any user-created index on

                                 * the TOAST table, since we don't bother to update anything else.

***************

*** 1685,1691 ****

                                                                                                                 toastrel,

                                                                                                                 toastidxs[i]->rd_index->indisunique ?

                                                                                                                 UNIQUE_CHECK_YES : UNIQUE_CHECK_NO,

!                                                                                                               BuildIndexInfo(toastidxs[i]));

                                }

 

                                /*

--- 1686,1692 ----

                                                                                                                 toastrel,

                                                                                                                 toastidxs[i]->rd_index->indisunique ?

                                                                                                                 UNIQUE_CHECK_YES : UNIQUE_CHECK_NO,

!                                                                                                               NULL);

                                }

 

                                /*




Thanks,
Nitin Ahuja

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

Предыдущее
От: Etsuro Fujita
Дата:
Сообщение: Re: Incorrect grammar
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [bug fix] Cascaded standby cannot start after a clean shutdown