>
> On Fri, Jun 20, 1997 at 01:36:31PM -0400, Bruce Momjian wrote:
>
> > > I know, this, of course. But varchar without length does same
> > > thing. So, why we need text and varchar to co-exist?
> >
> > text always stores allocated bytes, text only stores used bytes.
>
> ???
>
> Try this:
>
> create table tab (t text, v varchar);
>
> Then make some inserts with different length, and you will see,
> both 't' and 'v' stores used bytes *only*...
>
> So, again my question - why we need two different types with
> identical behavior? I can use varchar for indexes, but I can use
> text for this purpose too... Where is the difference?
>
> And, why length of varchar() is limited to 4096, not, eg. 6144?
Now I am confused. Does varchar() store only used bytes? Then the FAQ
is wrong. It says char() and varchar() always store maximum length.
The answer to your question of why they both exist is that postgres
initially had only text, and char() and varchar() were added for SQL
compatability.
- --
Bruce Momjian
maillist@candle.pha.pa.us
------------------------------