diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index dcb61ec132901cf37c39e4fff62a54acf9fc42da..88438af70c89f6dd8620073887c6f68994c1e2da 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.85 1999/07/03 00:32:44 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.86 1999/07/04 04:55:59 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -3385,9 +3385,9 @@ Character: character '(' Iconst ')' if ($3 < 1) elog(ERROR,"length for '%s' type must be at least 1",$1); - else if ($3 > MaxTupleSize) + else if ($3 > MaxAttrSize) elog(ERROR,"length for type '%s' cannot exceed %d",$1, - MaxTupleSize); + MaxAttrSize); /* we actually implement this sort of like a varlen, so * the first 4 bytes is the length. (the difference diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index 1f1b8d64975e451acadfc15b2a865564a1639a28..d7bb2738cb8f91dc0adb062e2d61cb9a5bb97d33 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.47 1999/07/03 00:32:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.48 1999/07/04 04:56:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -82,9 +82,9 @@ bpcharin(char *s, int dummy, int32 atttypmod) else len = atttypmod - VARHDRSZ; - if (len > MaxTupleSize) + if (len > MaxAttrSize) elog(ERROR, "bpcharin: length of char() must be less than %d", - MaxTupleSize); + MaxAttrSize); result = (char *) palloc(atttypmod); VARSIZE(result) = atttypmod; @@ -153,9 +153,9 @@ bpchar(char *s, int32 len) rlen = len - VARHDRSZ; - if (rlen > MaxTupleSize) + if (rlen > MaxAttrSize) elog(ERROR, "bpchar: length of char() must be less than %d", - MaxTupleSize); + MaxAttrSize); #ifdef STRINGDEBUG printf("bpchar- convert string length %d (%d) ->%d (%d)\n", @@ -335,9 +335,9 @@ varcharin(char *s, int dummy, int32 atttypmod) if (atttypmod != -1 && len > atttypmod) len = atttypmod; /* clip the string at max length */ - if (len > MaxTupleSize) + if (len > MaxAttrSize) elog(ERROR, "varcharin: length of char() must be less than %d", - MaxTupleSize); + MaxAttrSize); result = (char *) palloc(len); VARSIZE(result) = len; @@ -407,9 +407,9 @@ varchar(char *s, int32 slen) len = slen - VARHDRSZ; #endif - if (len > MaxTupleSize) + if (len > MaxAttrSize) elog(ERROR, "varchar: length of varchar() must be less than %d", - MaxTupleSize); + MaxAttrSize); result = (char *) palloc(slen); VARSIZE(result) = slen; diff --git a/src/include/access/htup.h b/src/include/access/htup.h index 9ad5d4e123ffc2ad456bf0d7d3c1143e3ed85ad5..8eda1020d35da8dc2e1eacb4c3173d52ee351fae 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: htup.h,v 1.18 1999/07/03 01:57:53 momjian Exp $ + * $Id: htup.h,v 1.19 1999/07/04 04:56:01 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -56,7 +56,9 @@ typedef HeapTupleHeaderData *HeapTupleHeader; #define MinTupleSize (DOUBLEALIGN(sizeof (PageHeaderData) + \ sizeof(HeapTupleHeaderData) + sizeof(int4))) -#define MaxTupleSize (BLCKSZ/2 - MinTupleSize) +#define MaxTupleSize (BLCKSZ - MinTupleSize) + +#define MaxAttrSize (MaxTupleSize - sizeof(HeapTupleHeaderData)) #define SelfItemPointerAttributeNumber (-1) #define ObjectIdAttributeNumber (-2) diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 75127b308d99b7c4cd32062e7f31d0851d7c2059..bbb1e785b438e2a6fd69dae7b8d96c5e0a75d9b7 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -3354,8 +3354,8 @@ Character: character '(' Iconst ')' sprintf(errortext, "length for '%s' type must be at least 1",$1); yyerror(errortext); } - else if (atol($3) > MaxTupleSize) { - sprintf(errortext, "length for type '%s' cannot exceed %d",$1,MaxTupleSize); + else if (atol($3) > MaxAttrSize) { + sprintf(errortext, "length for type '%s' cannot exceed %d",$1,MaxAttrSize); yyerror(errortext); }