There is no practical difference between “varchar” and “text”. “varchar(n)” is also not really any different than “varchar CHECK length(varchar) <= n” – meaning that the implementation of the data is the same but validation occurs during entry. One thing I have seen is that “varchar” is sometimes treated (by third-party GUI tools) as not supposed to contain any control characters (even though the type itself is not limited in that way) while the “text” type can contain any valid textual content (including escapes such as \n and \t). The GUI would use some kind of multi-line control to display “text” content while it would use a simple single-line control to display “varchar”. In other terms the more limited/defined the semantics of the possible values (e.g., labels, categories, titles) the more likely I am to use “varchar”. I use “text” when the contents are going to be free-form and if I expect to use newlines and other control characters in the contents. Dave From: pgsql-general-owner@xxxxxxxxxxxxxx [mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Moshe Jacobson Is there any practical difference between defining a column as a varchar(n) vs. a varchar vs. a text field? I've always been under the impression that if I am wanting to index a varchar column, it is better to set a maximum length. Is this correct? But more importantly, what's the practical difference between varchar with no limit and text? Thanks, and apologies if this is a FAQ... Moshe -- Moshe Jacobson 2323 Cumberland Parkway, Suite 201 | Atlanta, GA 30339 |