Re: [HACKERS] Tuple size - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Tuple size
Date
Msg-id 04b4b309c476adddbdd89374069c3163
Whole thread Raw
In response to [HACKERS] Tuple size  (Alexander Demenshin <aldem@techie.com>)
List pgsql-hackers
>
> 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

------------------------------

pgsql-hackers by date:

Previous
From: "Martin J. Laubach"
Date:
Subject: Re: [HACKERS] 6.1 jumbo patch?
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Tuple size