Re: Does converting an indexed varchar to text rewrite its index?Docs say so, tests say no.

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Does converting an indexed varchar to text rewrite its index?Docs say so, tests say no.
Дата
Msg-id f3a6e34e-ebc6-e740-0f6f-f79d7a568f76@aklaver.com
обсуждение исходный текст
Ответ на Re: Does converting an indexed varchar to text rewrite its index?Docs say so, tests say no.  (Mike Lissner <mlissner@michaeljaylissner.com>)
Ответы Re: Does converting an indexed varchar to text rewrite its index? Docs say so, tests say no.
Список pgsql-general
On 1/23/20 1:28 PM, Mike Lissner wrote:
> You wrote:
> 
>   > Well it did not rebuilt the index("t1_name_idx") you created on name.
> 
> OK, so then the docs *are* wrong? They say that:
> 
>  > any indexes on the affected columns must still be rebuilt.
> 
> But that doesn't happen? Sorry to be persistent. I'm just a bit confused 
> here.

My guess is that it is because in Postgres varchar is just text with an 
optional length restriction. I say optional because you can do:

CREATE TABLE t2 (id serial PRIMARY KEY, name varchar);

So as I understand it when you are go from varchar to text you are not 
really changing type, just the type oid. I tried searching the source 
for confirmation of this to no avail. A definitive answer is going to 
need come from someone with more knowledge of the internals.




-- 
Adrian Klaver
adrian.klaver@aklaver.com



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

Предыдущее
От: Mike Lissner
Дата:
Сообщение: Re: Does converting an indexed varchar to text rewrite its index?Docs say so, tests say no.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Does converting an indexed varchar to text rewrite its index? Docs say so, tests say no.