Re: Q: fixing collation version mismatches

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: Q: fixing collation version mismatches
Дата
Msg-id CAOBaU_a9CdkLHkTzvezdye=UnA=U09KweK62-DKgm99hD9gcdQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Q: fixing collation version mismatches  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Ответы Re: Q: fixing collation version mismatches  (Julien Rouhaud <rjuju123@gmail.com>)
Список pgsql-general
Le lun. 14 nov. 2022 à 05:58, Karsten Hilbert <Karsten.Hilbert@gmx.net> a écrit :
Am Sun, Nov 13, 2022 at 12:46:53PM -0800 schrieb Christophe Pettus:

> > On Nov 13, 2022, at 12:45, Karsten Hilbert <Karsten.Hilbert@gmx.net> wrote:
> >     REINDEX DATABASE db_in_question;
> >     ALTER DATABASE db_in_question REFRESH COLLATION VERSION;
> >     ALTER COLLATION every_collation_from_pg_collation REFRESH VERSION;
>
> I may be totally off-base here, but shouldn't the REINDEX be the last step?

To my understanding, the REFRESH statements "merely" update
the version information stored in the related objects. They
do not change anything else; and the REINDEX does not
reference them in any way.

I suppose the REINDEX goes first as it does the actual fixing
of now-invalid objects by rebuilding them. After that one is
back to a usable database state, even if left with pesky
(albeit harmless) warnings on version mismatches -- which to
get rid of one runs the REFRESH statements.

Or so my understanding...

yes exactly. but it's likely that people will have some form of automation to run the reindex if there's any discrepancy between the recorded collation version and recorded version, so if you first fix the versions metada and then encounter any error during the reindex, you won't know if you need to reindex or not and might end up with corrupt indexes. 

Which is why my question still stands: does the above
three-strikes operation safely take care of any collation
issues that may currently exist in a database ?

yes

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

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: Re: Q: fixing collation version mismatches
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: Q: fixing collation version mismatches