pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Mike Lissner <mlissner@michaeljaylissner.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Does converting an indexed varchar to text rewrite its index? Docs say so, tests say no.
Date: Thu, 23 Jan 2020 14:01:15 -0800
Message-ID: <f3a6e34e-ebc6-e740-0f6f-f79d7a568f76@aklaver.com> (raw)
In-Reply-To: <CAMp9=EyRZdxNR1+_gO-odzhqNREiOYPRvA8+XT80U7_Wy=x=ng@mail.gmail.com>
References: <CAMp9=ExXtH0NeF+LTsNrew_oXycAJTNVKbRYnqgoEAT01t=67A@mail.gmail.com>
	<18e832ea-4bae-8c47-fdfe-e2cf316f52ce@aklaver.com>
	<CAMp9=EyEMDKswjY5r9F7B0b2_FaeY_oYVbze=aeBTEExuaC7RQ@mail.gmail.com>
	<7c433efb-0a46-1ab2-930a-04e83efa31af@aklaver.com>
	<CAMp9=EyRZdxNR1+_gO-odzhqNREiOYPRvA8+XT80U7_Wy=x=ng@mail.gmail.com>

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





view thread (9+ messages)  latest in thread

Message-ID: <f3a6e34e-ebc6-e740-0f6f-f79d7a568f76@aklaver.com>
Permalink:  ../f3a6e34e-ebc6-e740-0f6f-f79d7a568f76@aklaver.com/
Also on:    postgresql.org/message-id/f3a6e34e-ebc6-e740-0f6f-f79d7a568f76@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, mlissner@michaeljaylissner.com
  Subject: Re: Does converting an indexed varchar to text rewrite its index? Docs say so, tests say no.
  In-Reply-To: <f3a6e34e-ebc6-e740-0f6f-f79d7a568f76@aklaver.com>
  References: <CAMp9=ExXtH0NeF+LTsNrew_oXycAJTNVKbRYnqgoEAT01t=67A@mail.gmail.com> <18e832ea-4bae-8c47-fdfe-e2cf316f52ce@aklaver.com> <CAMp9=EyEMDKswjY5r9F7B0b2_FaeY_oYVbze=aeBTEExuaC7RQ@mail.gmail.com> <7c433efb-0a46-1ab2-930a-04e83efa31af@aklaver.com> <CAMp9=EyRZdxNR1+_gO-odzhqNREiOYPRvA8+XT80U7_Wy=x=ng@mail.gmail.com> <f3a6e34e-ebc6-e740-0f6f-f79d7a568f76@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox