Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteba4184

Browse files
committed
Clarify maximum tuple and max attribute lengths.
1 parentb31aa64 commiteba4184

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

‎src/backend/parser/gram.y

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.85 1999/07/03 00:32:44 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.86 1999/07/04 04:55:59 momjian Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -3385,9 +3385,9 @@ Character: character '(' Iconst ')'
33853385

33863386
if ($3 < 1)
33873387
elog(ERROR,"length for '%s' type must be at least 1",$1);
3388-
else if ($3 >MaxTupleSize)
3388+
else if ($3 >MaxAttrSize)
33893389
elog(ERROR,"length for type '%s' cannot exceed %d",$1,
3390-
MaxTupleSize);
3390+
MaxAttrSize);
33913391

33923392
/* we actually implement this sort of like a varlen, so
33933393
* the first 4 bytes is the length. (the difference

‎src/backend/utils/adt/varchar.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.47 1999/07/03 00:32:50 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.48 1999/07/04 04:56:00 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -82,9 +82,9 @@ bpcharin(char *s, int dummy, int32 atttypmod)
8282
else
8383
len=atttypmod-VARHDRSZ;
8484

85-
if (len>MaxTupleSize)
85+
if (len>MaxAttrSize)
8686
elog(ERROR,"bpcharin: length of char() must be less than %d",
87-
MaxTupleSize);
87+
MaxAttrSize);
8888

8989
result= (char*)palloc(atttypmod);
9090
VARSIZE(result)=atttypmod;
@@ -153,9 +153,9 @@ bpchar(char *s, int32 len)
153153

154154
rlen=len-VARHDRSZ;
155155

156-
if (rlen>MaxTupleSize)
156+
if (rlen>MaxAttrSize)
157157
elog(ERROR,"bpchar: length of char() must be less than %d",
158-
MaxTupleSize);
158+
MaxAttrSize);
159159

160160
#ifdefSTRINGDEBUG
161161
printf("bpchar- convert string length %d (%d) ->%d (%d)\n",
@@ -335,9 +335,9 @@ varcharin(char *s, int dummy, int32 atttypmod)
335335
if (atttypmod!=-1&&len>atttypmod)
336336
len=atttypmod;/* clip the string at max length */
337337

338-
if (len>MaxTupleSize)
338+
if (len>MaxAttrSize)
339339
elog(ERROR,"varcharin: length of char() must be less than %d",
340-
MaxTupleSize);
340+
MaxAttrSize);
341341

342342
result= (char*)palloc(len);
343343
VARSIZE(result)=len;
@@ -407,9 +407,9 @@ varchar(char *s, int32 slen)
407407
len=slen-VARHDRSZ;
408408
#endif
409409

410-
if (len>MaxTupleSize)
410+
if (len>MaxAttrSize)
411411
elog(ERROR,"varchar: length of varchar() must be less than %d",
412-
MaxTupleSize);
412+
MaxAttrSize);
413413

414414
result= (char*)palloc(slen);
415415
VARSIZE(result)=slen;

‎src/include/access/htup.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: htup.h,v 1.18 1999/07/03 01:57:53 momjian Exp $
9+
* $Id: htup.h,v 1.19 1999/07/04 04:56:01 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -56,7 +56,9 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
5656
#defineMinTupleSize(DOUBLEALIGN(sizeof (PageHeaderData) + \
5757
sizeof(HeapTupleHeaderData) + sizeof(int4)))
5858

59-
#defineMaxTupleSize(BLCKSZ/2 - MinTupleSize)
59+
#defineMaxTupleSize(BLCKSZ - MinTupleSize)
60+
61+
#defineMaxAttrSize(MaxTupleSize - sizeof(HeapTupleHeaderData))
6062

6163
#defineSelfItemPointerAttributeNumber(-1)
6264
#defineObjectIdAttributeNumber(-2)

‎src/interfaces/ecpg/preproc/preproc.y

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3354,8 +3354,8 @@ Character: character '(' Iconst ')'
33543354
sprintf(errortext,"length for '%s' type must be at least 1",$1);
33553355
yyerror(errortext);
33563356
}
3357-
elseif (atol($3) >MaxTupleSize) {
3358-
sprintf(errortext,"length for type '%s' cannot exceed %d",$1,MaxTupleSize);
3357+
elseif (atol($3) >MaxAttrSize) {
3358+
sprintf(errortext,"length for type '%s' cannot exceed %d",$1,MaxAttrSize);
33593359
yyerror(errortext);
33603360
}
33613361

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp