WIP : change tablespace for a database
От | Guillaume Lelarge |
---|---|
Тема | WIP : change tablespace for a database |
Дата | |
Msg-id | 48F62DAC.2080308@lelarge.info обсуждение исходный текст |
Ответы |
Re: WIP : change tablespace for a database
|
Список | pgsql-hackers |
Hi, I'm currently working on a patch for the TODO item : Allow databases to be moved to different tablespaces I already changed the syntax, added some code to move the relations of the specific database to the target tablespace. It works. But I have three issues I would like to discuss. To get the list of relations to move, the user needs to be connected to the database. It seems awkward to launch an ALTER DATABASE statement on the currently open database. I mean, this is what I do know: guillaume@laptop$ psql db1 psql (8.4devel) Type "help" for help. db1=# ALTER DATABASE db1 TABLESPACE ts1; I don't think we can do another way, do you? One other thing, a much worse one. It seems I can't move sys objects. There's this comment in ATExecSetTableSpace function: /** We can never allow moving of shared or nailed-in-cache relations,* because we can't support changing their reltablespacevalues.*/ I do understand we forbid moving a system relation when using the ALTER TABLE SET TABLESPACE statement. But I wonder if it could be done with an ALTER DATABASE TABLESPACE statement. And last issue, when I do my ALTER DATABASE TABLESPACE statement, all relations are moved on the target tablespace, and the dattablespace field (in pg_database catalog) is updated with the new value. When this is done, a few moment after, I get messages telling me PG_VERSION file is not available in the pg_tblspc/<tablespace oid>/<database oid> directory. I know about the set_short_version() function in backend/commands/tablespace.c but I'm not sure I should use this function. In fact, I wonder why this file is not created at the first move of a table. Comments and suggestions welcome! -- Guillaume.http://www.postgresqlfr.orghttp://dalibo.com
В списке pgsql-hackers по дате отправления: