renaming index leaves database inconsistent

Поиск
Список
Период
Сортировка
От Richard Poole
Тема renaming index leaves database inconsistent
Дата
Msg-id E11v87Z-0007BU-00@sapphire.noc.gxn.net
обсуждение исходный текст
Список pgsql-bugs
Your name        : Richard Poole
Your email address    : rp@gxn.net


System Configuration
---------------------
  Architecture (example: Intel Pentium)      : Intel Pentium

  Operating System (example: Linux 2.0.26 ELF)     : Linux 2.2.5 ELF

  PostgreSQL version (example: PostgreSQL-6.5.3): PostgreSQL-6.5.3

  Compiler used (example:  gcc 2.8.0)        : egcs 1.1.2


Please enter a FULL description of your problem:
------------------------------------------------

If I try to do ALTER TABLE ... RENAME on an index, it fails and does not
change the system catalogues, but does rename the file containing the
index. Any operation which would access the index then fails.

I know I shouldn't do that but if I try it should fail gracefully; as it
is this seems to need hand-repairing.

Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

rptest=> create table foo(i int);
CREATE
rptest=> create index foo_index on foo(i);
CREATE
rptest=> alter table foo_index rename to new_foo_index;
ERROR:  TypeRename: type foo_index not defined
rptest=> insert into foo values (42);
ERROR:  mdopen: couldn't open foo_index: No such file or directory
rptest=> \q
[rp@judy rp]$ su postgres
Password:
[postgres@judy rp]$ ls /var/pgsql/base/rptest/ | grep foo
foo
new_foo_index


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

I don't know the code at all, but it seems there should be a check at the
top of renamerel() (in src/backend/commands/rename.c) that the relation
you're renaming isn't an index, before you do the rename of the file.
Alternatively it would be nice if you *could* rename indices, but I don't
know what other repercussions that might have.




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

Предыдущее
От: Daniel Stolk
Дата:
Сообщение: Too large tuples corrupting tables
Следующее
От: Richard Poole
Дата:
Сообщение: renaming index leaves database inconsistent