From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Mikhail Terekhov <terekhov(at)emc(dot)com> |
Cc: | "Bruce Momjian"(at)candle(dot)pha(dot)pa(dot)us, root(at)candle(dot)pha(dot)pa(dot)us, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: Tuple too big |
Date: | 1999-07-03 02:00:44 |
Message-ID: | 199907030200.WAA23471@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> I've encountered a strange behavior of the VACUUM ANALYZE command.
> It seems that this command works only if the size of a text field
> does not exceed approximately 4050 bytes! So the real limit on
> tuple size is a half of the max tuple size. I've checked this effect
> on Postgres 6.4.2 (Sparc Solaris 2.5.1) and Postgres 6.5 (SUSE 6.1
> Linux, kernel 2.2.5). Is this a bug or known feature?
> The python script used to reproduce this problem and results for
> v6.4.2 and v6.5 are follows.
>
OK, looks like the new code works:
test=> create table test (x char(2000), y char(2000), z char(2000))\g
CREATE
test=> insert into test values ('1','2','3');
ERROR: Tuple is too big: size 6044, max size 4044
test=> create table test2 (x varchar(2000), y varchar(2000), z
varchar(2000))\g
CREATE
test=> insert into test2 values ('1','2','3');
INSERT 21303 1
char() is fixed length, while varchar() is variable. Now, we could
prevent creation of the first table, but not the second because only the
inserted data will show if it over the limit. Much easier just to test
in one place.
Here is the new patch:
---------------------------------------------------------------------------
Index: hio.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/access/heap/hio.c,v
retrieving revision 1.20
retrieving revision 1.22
diff -c -r1.20 -r1.22
*** hio.c 1999/05/25 16:07:07 1.20
--- hio.c 1999/07/03 01:56:16 1.22
***************
*** 16,21 ****
--- 16,22 ----
#include <storage/bufpage.h>
#include <access/hio.h>
+ #include <access/htup.h>
#include <access/heapam.h>
#include <storage/bufmgr.h>
#include <utils/memutils.h>
***************
*** 164,169 ****
--- 165,173 ----
if (len > PageGetFreeSpace(pageHeader))
elog(ERROR, "Tuple is too big: size %d", len);
}
+
+ if (len > MaxTupleSize)
+ elog(ERROR, "Tuple is too big: size %d, max size %d", len, MaxTupleSize);
if (!relation->rd_myxactonly)
UnlockPage(relation, 0, ExclusiveLock);
--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Wayne Piekarski | 1999-07-03 07:51:39 | Re: [HACKERS] Update on my 6.4.2 progress |
Previous Message | Bruce Momjian | 1999-07-03 00:30:34 | Re: [HACKERS] Re: Tuple too big |