Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YA1fY-0000bk-FX for pgsql-admin@arkaria.postgresql.org; Sat, 10 Jan 2015 19:25:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YA1fX-0000JN-Q7 for pgsql-admin@arkaria.postgresql.org; Sat, 10 Jan 2015 19:25:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YA1fX-0000JH-56 for pgsql-admin@postgresql.org; Sat, 10 Jan 2015 19:25:55 +0000 Received: from mwork.nabble.com ([162.253.133.43]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YA1fT-0005w0-0z for pgsql-admin@postgresql.org; Sat, 10 Jan 2015 19:25:54 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mwork.nabble.com (Postfix) with ESMTP id C7763101C120 for ; Sat, 10 Jan 2015 11:25:49 -0800 (PST) Date: Sat, 10 Jan 2015 12:25:48 -0700 (MST) From: David G Johnston To: pgsql-admin@postgresql.org Message-ID: <1420917948381-5833533.post@n5.nabble.com> In-Reply-To: References: <2BC18916DE4BF141AC1EFC55CE2CAE7D614327@NAEANRFKXM01V.nadsusea.nads.navy.mil> Subject: Re: PK/FK impacts using text data type MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.3 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Albe Laurenz *EXTERN* wrote > Denise Ferrell wrote: >> We have been discussing whether or not to change all of our varchar >> (character varying) >> data types to text for ease of use in procedures/functions/triggers... >> >> Are there any impacts on keys by using text data type vs. character >> varying or character varying(n)? > > The only useful thing about varchar is that it imposes a length constraint > on a database field. > > Values used for indexing have a length limit, so if you change an indexed > column to text > somebody could try to insert values that will cause errors because the > limit has been exceeded. > > Also you application code cannot rely on a certain size limit any more. > > If you are ok with that, go ahead and use text. > > Yours, > Laurenz Albe Appropriate check constraints can handle the majority of the needed cases. In theory, domains would be helpful here too but I'm not totally conversant on them at the moment. David J. -- View this message in context: http://postgresql.nabble.com/PK-FK-impacts-using-text-data-type-tp5833407p5833533.html Sent from the PostgreSQL - admin mailing list archive at Nabble.com. -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin