Clarify maximum tuple and max attribute lengths.
This commit is contained in:
parent
b31aa64f4a
commit
eba41848aa
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -3385,9 +3385,9 @@ Character: character '(' Iconst ')'
|
|||||||
|
|
||||||
if ($3 < 1)
|
if ($3 < 1)
|
||||||
elog(ERROR,"length for '%s' type must be at least 1",$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,
|
elog(ERROR,"length for type '%s' cannot exceed %d",$1,
|
||||||
MaxTupleSize);
|
MaxAttrSize);
|
||||||
|
|
||||||
/* we actually implement this sort of like a varlen, so
|
/* we actually implement this sort of like a varlen, so
|
||||||
* the first 4 bytes is the length. (the difference
|
* the first 4 bytes is the length. (the difference
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
else
|
||||||
len = atttypmod - VARHDRSZ;
|
len = atttypmod - VARHDRSZ;
|
||||||
|
|
||||||
if (len > MaxTupleSize)
|
if (len > MaxAttrSize)
|
||||||
elog(ERROR, "bpcharin: length of char() must be less than %d",
|
elog(ERROR, "bpcharin: length of char() must be less than %d",
|
||||||
MaxTupleSize);
|
MaxAttrSize);
|
||||||
|
|
||||||
result = (char *) palloc(atttypmod);
|
result = (char *) palloc(atttypmod);
|
||||||
VARSIZE(result) = atttypmod;
|
VARSIZE(result) = atttypmod;
|
||||||
@ -153,9 +153,9 @@ bpchar(char *s, int32 len)
|
|||||||
|
|
||||||
rlen = len - VARHDRSZ;
|
rlen = len - VARHDRSZ;
|
||||||
|
|
||||||
if (rlen > MaxTupleSize)
|
if (rlen > MaxAttrSize)
|
||||||
elog(ERROR, "bpchar: length of char() must be less than %d",
|
elog(ERROR, "bpchar: length of char() must be less than %d",
|
||||||
MaxTupleSize);
|
MaxAttrSize);
|
||||||
|
|
||||||
#ifdef STRINGDEBUG
|
#ifdef STRINGDEBUG
|
||||||
printf("bpchar- convert string length %d (%d) ->%d (%d)\n",
|
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)
|
if (atttypmod != -1 && len > atttypmod)
|
||||||
len = atttypmod; /* clip the string at max length */
|
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",
|
elog(ERROR, "varcharin: length of char() must be less than %d",
|
||||||
MaxTupleSize);
|
MaxAttrSize);
|
||||||
|
|
||||||
result = (char *) palloc(len);
|
result = (char *) palloc(len);
|
||||||
VARSIZE(result) = len;
|
VARSIZE(result) = len;
|
||||||
@ -407,9 +407,9 @@ varchar(char *s, int32 slen)
|
|||||||
len = slen - VARHDRSZ;
|
len = slen - VARHDRSZ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (len > MaxTupleSize)
|
if (len > MaxAttrSize)
|
||||||
elog(ERROR, "varchar: length of varchar() must be less than %d",
|
elog(ERROR, "varchar: length of varchar() must be less than %d",
|
||||||
MaxTupleSize);
|
MaxAttrSize);
|
||||||
|
|
||||||
result = (char *) palloc(slen);
|
result = (char *) palloc(slen);
|
||||||
VARSIZE(result) = slen;
|
VARSIZE(result) = slen;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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) + \
|
#define MinTupleSize (DOUBLEALIGN(sizeof (PageHeaderData) + \
|
||||||
sizeof(HeapTupleHeaderData) + sizeof(int4)))
|
sizeof(HeapTupleHeaderData) + sizeof(int4)))
|
||||||
|
|
||||||
#define MaxTupleSize (BLCKSZ/2 - MinTupleSize)
|
#define MaxTupleSize (BLCKSZ - MinTupleSize)
|
||||||
|
|
||||||
|
#define MaxAttrSize (MaxTupleSize - sizeof(HeapTupleHeaderData))
|
||||||
|
|
||||||
#define SelfItemPointerAttributeNumber (-1)
|
#define SelfItemPointerAttributeNumber (-1)
|
||||||
#define ObjectIdAttributeNumber (-2)
|
#define ObjectIdAttributeNumber (-2)
|
||||||
|
@ -3354,8 +3354,8 @@ Character: character '(' Iconst ')'
|
|||||||
sprintf(errortext, "length for '%s' type must be at least 1",$1);
|
sprintf(errortext, "length for '%s' type must be at least 1",$1);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
else if (atol($3) > MaxTupleSize) {
|
else if (atol($3) > MaxAttrSize) {
|
||||||
sprintf(errortext, "length for type '%s' cannot exceed %d",$1,MaxTupleSize);
|
sprintf(errortext, "length for type '%s' cannot exceed %d",$1,MaxAttrSize);
|
||||||
yyerror(errortext);
|
yyerror(errortext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user