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

From Bruce Momjian
Subject Re: [HACKERS] Tuple size
Date
Msg-id 82d883cb9fda83143e0deeb048f608d9
Whole thread Raw
In response to [HACKERS] Tuple size  (Alexander Demenshin <aldem@techie.com>)
List pgsql-hackers
>
> > > From a friendly Alexander Dememshin:
> > >
> > > Hi!
> > >
> > >   I have tried:
> > >
> > > create table tab (v1 char(4096), v2 char(4096), v3 char(4096));
> > >
> > >   Then:
> > >
> > > insert into tab values('1');
> > >
> > >   OK
> > >
> > > insert into tab values('1','2');
> > >
> > >   Tuple is too big: size 8256.
> > >
> > >   Well, I understand why, but type 'char' is *fixed* length type,
> > >   so even if I don't use some attributes, it *must* be inserted
> > >   with all spaces... At least, I expected this... In this case
> > >   I must get "tuple is too big" even if I will insert "empty"
> > >   record. It is not so - why?
> >
> > Bruce Momjian wrote:
> >
> > NULL has zero length.
>
> I think Alexander is questioning the fact that postgres let him make a table
> with three fields totaling 12k in size when the max tuple size is at about
> 8000 bytes or so now.  Seems to me that "create table" code should check the
> size of all attributes, at least when a size is given.  For "text" and any
> other types that don't need a fixed size at create time, this understandably
> can't be done, but for other sized types, IMHO, it should.

True, he should be warned, but the fact is that varchar() and char() are
of limited usefulness when text is availble, and we can't issue a
warning for text.

- --
Bruce Momjian
maillist@candle.pha.pa.us

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

pgsql-hackers by date:

Previous
From: aixssd!darrenk@abs.net (Darren King)
Date:
Subject: Re: [HACKERS] Tuple size
Next
From: aixssd!darrenk@abs.net (Darren King)
Date:
Subject: Re: [HACKERS] TR: Problems with Large Objects !!