Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iukXT-00038m-9Q for pgsql-general@arkaria.postgresql.org; Thu, 23 Jan 2020 22:01:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iukXS-0004df-2L for pgsql-general@arkaria.postgresql.org; Thu, 23 Jan 2020 22:01:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iukXQ-0004dY-LN for pgsql-general@lists.postgresql.org; Thu, 23 Jan 2020 22:01:21 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iukXN-00077X-NU for pgsql-general@lists.postgresql.org; Thu, 23 Jan 2020 22:01:19 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 95FCF21FE0; Thu, 23 Jan 2020 17:01:16 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 23 Jan 2020 17:01:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=I wdvLug9VwyYKSStI06ZvoBp6Y2eoT7vHv+34PkPnL4=; b=GgXzTr+qcRnr6W4/1 l7/bpTMk162PKxLHhBOax8ER2JsCmqflEa7BhpVC2gXmSirLfpr4QX/sydzNZOpG 9B6TIr0bS8p6tLphGTKsSi0jYmaAjbjdFE1Ze9yHTD6ntF17JV9LhyvfkZK3AwNl DKZS93XZoowIw03dfqUb0MGC5yL4gOqkDJno3xCdyG5mVrv2qagasKbw4ZK/5BcF pUm0d/cIuDXjDR+pKKp1xC73YpZUkoIbpyfySOneLyn1lKM4EhrIWW3dPCjLEOL4 MOaVVDZr6RSyisSbXQ3ATpAB0P/cky0RlL2sifGa5Ecu3oR5gdAhY3+lFnjK/pAv xFeNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=IwdvLug9VwyYKSStI06ZvoBp6Y2eoT7vHv+34PkPn L4=; b=H/IWE/49fiXhmcknELito9arSTuAM5XEtd1U7SxN9Thry0wAQK9xfxYjH moZcRuPjXHpwB1R+crM/YqVMzwU0aE4hvnUM7ryrNsxzsXwh4c4ywdeKCbVhfrwu P/Xl5n6RyeWX8g3i72TjA19gLPqLb2BzHjV34V+vhKlgYhv6H4/YTUkS8LiGnPMZ 5b/Ny0wC5c6wa/J/CqPkyEgiFDmLGvqxsYPOObr55TX16NqLXIN+3rLA9srB2BBK zoYQu3n53x/XV0zkQjgxMAo6RdtCuzvr6jNg9bdwrNNWygzqvGMK4MARFniPG9Q4 yo7tz/p/HVOt5rWCrTWtqrWgjnoOQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrvddvgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecukfhppeejuddrvdduvddruddvledrudelfeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrg hvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id E9D843060981; Thu, 23 Jan 2020 17:01:15 -0500 (EST) Subject: Re: Does converting an indexed varchar to text rewrite its index? Docs say so, tests say no. To: Mike Lissner Cc: pgsql-general@lists.postgresql.org References: <18e832ea-4bae-8c47-fdfe-e2cf316f52ce@aklaver.com> <7c433efb-0a46-1ab2-930a-04e83efa31af@aklaver.com> From: Adrian Klaver Message-ID: Date: Thu, 23 Jan 2020 14:01:15 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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