nataraj: (Бритый небритый)
[personal profile] nataraj
It seems to me that I found a bug in current implementation of reloptions: When you are creating a custom index with it's own reloptions, you have no ways to prevent it from changing using ALTER INDEX .... SET (op=value);
For example if you do for bloom index
alter index bloomidx set ( length=15 );

postgres will successfully run this, change the value of reloptions attribute in pg_class, and bloom index will work wrong after it.
And there is no way to forbid this from inside of an extension.

I think I would add there a flag in reloption descriptor that will tell whether it is allowed to change this reloption using ALTER INDEX, or not

Date: 2016-05-25 11:21 pm (UTC)
From: (Anonymous)
Hmm, how about forcing rebuild of index instead of forbidding change?

Date: 2016-05-26 10:17 am (UTC)
ext_613079: Default userpic (Бритый небритый)
From: [identity profile] shaplov.livejournal.com
I think -- no.

Now in the ALTER INDEX code there is no tools for rebuilding index now. (There is one in ALTER COLUMN, but they are in different parts of the code). Adding it there will take some amount of work, and I do not think worth it. ALTERing INDEX is a manual and quite rare operation. User can easily create a new index and delete an old one.

But we must prevent user from changing option that will lead to index misfunction. That is why I am speaking about forbidding changing such options.

Date: 2016-05-26 02:00 am (UTC)
From: (Anonymous)
Perhaps a 'requires index rebuild' rather than 'forbid change' setting?

Date: 2016-05-26 10:18 am (UTC)
ext_613079: Default userpic (Бритый небритый)
From: [identity profile] shaplov.livejournal.com
See answer for previous comment

Date: 2016-05-26 02:04 am (UTC)
From: [identity profile] astarsan.livejournal.com
До этого времени не было reloptions у индексов которые нельзя менять на лету. Вот и не было механизма.

Date: 2016-05-26 10:19 am (UTC)
ext_613079: Default userpic (Бритый небритый)
From: [identity profile] shaplov.livejournal.com
Ну да... Но вот теперь добавилась возможность создавать кастомные индексы с кастомными опциями, и такая потребность -- возникла... Вот bloom индекс из контриба devel ветки можно так сломать...

Profile

nataraj: (Default)
Swami Dhyan Nataraj

July 2024

S M T W T F S
 123456
789 10111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 21st, 2026 02:40 am
Powered by Dreamwidth Studios