Re: char o varchar - Mailing list pgsql-general

From scott.marlowe
Subject Re: char o varchar
Date
Msg-id Pine.LNX.4.33.0309161434100.5612-100000@css120.ihs.com
Whole thread Raw
In response to char o varchar  ("Edwin Quijada" <listas_quijada@hotmail.com>)
List pgsql-general
On Tue, 16 Sep 2003, Edwin Quijada wrote:

>
>
>
>
> Hoii!!
>
> I am creating my struct and I have the question :
> What I must use for character fields char or varchar?
> Which are the differences? and the better

Generally speaking, varchar or text() types are preferred.  char() types
are padded.  I.e. if you create a table with char(8) and insert 'abc' then
select it, you'll get 'abc     ' back, i.e. abc followed by padding spaces
to make it 8 wide.

Most of the time this is not what the user wants.


pgsql-general by date:

Previous
From: Network Administrator
Date:
Subject: Re: State of Beta 2
Next
From: "scott.marlowe"
Date:
Subject: Re: Idea for improving speed of pg_restore