Re: [HACKERS] varchar size

Darren King <darrenk@insightdist.com>

From: darrenk@insightdist.com (Darren King)
To: pgsql-hackers@postgresql.org
Date: 1998-01-08T16:31:10Z
Lists: pgsql-hackers
> I have applied the following patch to allow varchar() fields to store
> just the needed bytes, and not the maximum size.
> 
> ...
> 
> And if I create a varchar(2000), it does not take several 8k blocks to
> store 10 rows, like it did before.

Fixes the following "problem" too...

Currently, you can create a table with attributes that _can_ total more
than the max_tup_size if they maximum size, but not be able to insert
valid data into all of them.

For instance, ...

create table foo (bar varchar(4000),
                  bah varchar(3000),
                  baz varchar(2000));

... is fine as long as one of the attributes is null.  Now you can have
non-null values for all three as long as they don't go over max_tup_size
in _total_.

darrenk