pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David G Johnston <david.g.johnston@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: PK/FK impacts using text data type
Date: Sat, 10 Jan 2015 12:25:48 -0700 (MST)
Message-ID: <1420917948381-5833533.post@n5.nabble.com> (raw)
In-Reply-To: <A737B7A37273E048B164557ADEF4A58B34E5C673@ntex2010a.host.magwien.gv.at>
References: <2BC18916DE4BF141AC1EFC55CE2CAE7D614327@NAEANRFKXM01V.nadsusea.nads.navy.mil>
	<A737B7A37273E048B164557ADEF4A58B34E5C673@ntex2010a.host.magwien.gv.at>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

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



view thread (4+ messages)

Message-ID: <1420917948381-5833533.post@n5.nabble.com>
Permalink:  ../1420917948381-5833533.post@n5.nabble.com/
Also on:    postgresql.org/message-id/1420917948381-5833533.post@n5.nabble.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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: david.g.johnston@gmail.com
  Subject: Re: PK/FK impacts using text data type
  In-Reply-To: <1420917948381-5833533.post@n5.nabble.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