Re: [GENERAL] varchar(n) VS text

2007-06-29 Thread Tom Lane
Kev <[EMAIL PROTECTED]> writes: > On Jun 26, 12:16 am, [EMAIL PROTECTED] (Tom Lane) wrote: >> "Pierre Thibaudeau" <[EMAIL PROTECTED]> writes: >>> I am puzzling over this issue: >>> 1) Is there ever ANY reason to prefer "varchar(n)" to "text" as a column >>> type? >> >> In words of one syllable: n

Re: [GENERAL] varchar(n) VS text

2007-06-29 Thread Kev
On Jun 26, 12:16 am, [EMAIL PROTECTED] (Tom Lane) wrote: > "Pierre Thibaudeau" <[EMAIL PROTECTED]> writes: > > I am puzzling over this issue: > > 1) Is there ever ANY reason to prefer "varchar(n)" to "text" as a column > > type? > > In words of one syllable: no. If you have any input from untrust

Re: [GENERAL] varchar(n) VS text

2007-06-27 Thread Alvaro Herrera
Paul Lambert wrote: > Looks like my bad - I created the table initially through pgAdminIII and > it appears I selected the wrong character varying from the dropdown list. > > CREATE TABLE tester > ( > test_varchar character varying[], > test_text text > ) > > If I change it to character va

Re: [GENERAL] varchar(n) VS text

2007-06-27 Thread Paul Lambert
Michael Glaesemann wrote: Works for me: test=# select version(); version -- PostgreSQL

Re: [GENERAL] varchar(n) VS text

2007-06-27 Thread Alvaro Herrera
Paul Lambert wrote: > Is there any disk space advantages to using varchar over text? Or will a > text field only ever use up as much data as it needs. 1. no 2. yes. -- Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4" "Hackers share the surgeon's secret pleasure in

Re: [GENERAL] varchar(n) VS text

2007-06-27 Thread Michael Glaesemann
On Jun 27, 2007, at 19:38 , Paul Lambert wrote: Is there any disk space advantages to using varchar over text? No. Or will a text field only ever use up as much data as it needs. Yes. From http://www.postgresql.org/docs/8.2/interactive/datatype- character.html The storage requirement

Re: [GENERAL] varchar(n) VS text

2007-06-27 Thread Paul Lambert
Tom Lane wrote: "Pierre Thibaudeau" <[EMAIL PROTECTED]> writes: I am puzzling over this issue: 1) Is there ever ANY reason to prefer "varchar(n)" to "text" as a column type? In words of one syllable: no. Not unless you have an application requirement for a specific maximum length limit (eg

Re: [GENERAL] varchar(n) VS text

2007-06-25 Thread Tom Lane
"Pierre Thibaudeau" <[EMAIL PROTECTED]> writes: > I am puzzling over this issue: > 1) Is there ever ANY reason to prefer "varchar(n)" to "text" as a column type? In words of one syllable: no. Not unless you have an application requirement for a specific maximum length limit (eg, your client code

Re: [GENERAL] varchar(n) VS text

2007-06-25 Thread Ben
On Mon, 25 Jun 2007, Pierre Thibaudeau wrote: From my reading of the dataype documentation, the ONLY reason I can think of for using "varchar(n)" would be in order to add an extra data-type constraint to the column. That's my understanding as well. I can think of a few reasons to use char(n)

[GENERAL] varchar(n) VS text

2007-06-25 Thread Pierre Thibaudeau
Having read http://www.postgresql.org/docs/8.2/interactive/datatype-character.html I am puzzling over this issue: 1) Is there ever ANY reason to prefer "varchar(n)" to "text" as a column type? 2) For instance, if I know that a character-type column will never contain more than 300 characters, w