Re: patch : Allow toast tables to be moved to a different tablespace

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: patch : Allow toast tables to be moved to a different tablespace
Дата
Msg-id 1323956011-sup-9589@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: patch : Allow toast tables to be moved to a different tablespace  (Julien Tachoires <julmon@gmail.com>)
Ответы Re: patch : Allow toast tables to be moved to a different tablespace  (Julien Tachoires <julmon@gmail.com>)
Список pgsql-hackers
Excerpts from Julien Tachoires's message of mar dic 13 14:29:56 -0300 2011:
> 2011/12/13 Robert Haas <robertmhaas@gmail.com>:
> > On Tue, Dec 13, 2011 at 12:02 PM, Julien Tachoires <julmon@gmail.com> wrote:
> >> Right, it seems to happen when the destination tablespace is the same
> >> as the database's tbs, because, in this case, relation's tbs is set to
> >> InvalidOid :
> >> src/backend/commands/tablecmds.c line 8342
> >>
> >> +       rd_rel->reltablespace = (newTableSpace == MyDatabaseTableSpace) ?
> >> InvalidOid : newTableSpace;
> >>
> >> Why don't just asign newTableSpace value here ?
> >
> > When a relation is stored in the default tablespace, we always record
> > that in the system catalogs as InvalidOid.  Otherwise, if the
> > database's default tablespace were changed, things would break.
>
> OK, considering that, I don't see any way to handle the case raised by Jaime :(

Uhm, surely you could compare the original toast tablespace to the heap
tablespace, and if they differ, handle appropriately when creating the
new toast table?  Just pass down the toast tablespace into
AlterTableCreateToastTable, instead of having it assume that
rel->rd_rel->relnamespace is sufficient.  This should be done in all
cases where a toast tablespace is created, which shouldn't be more than
a handful of them.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


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

Предыдущее
От: 高增琦
Дата:
Сообщение: why do we need create tuplestore for each fetch?
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Moving more work outside WALInsertLock