[HACKERS] Tuple size - Mailing list pgsql-hackers

From Alexander Demenshin
Subject [HACKERS] Tuple size
Date
Msg-id 96d3e1691509ccdc10fedf6a27521abd
Whole thread Raw
List pgsql-hackers
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?

  And one more: when I use 'varchar' without size, I get variable
  length attribute similar to 'text', which is stored with actual
  length, without padding. If I will specify length, it will be
  stored without padding, but will occupy specified number of bytes
  *always*, but, when retrieved, will return actual number of characters.
  Why not store only actual length, even if maximum specified?
  And, it will be listed as attribute with length zero, not 'var',
  but *actually* it is variable length, same as 'text'...

/Al

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

pgsql-hackers by date:

Previous
From: Fabrizio Sciarra
Date:
Subject: [HACKERS] Postgres Geo Data Types
Next
From: (Erik Bennett)
Date:
Subject: [HACKERS] rules