Skip to content

Commit 6d08b6a

Browse files
committed
Remove 4096 string limited key on block size
1 parent 0a8fb5a commit 6d08b6a

File tree

3 files changed

+14
-20
lines changed

3 files changed

+14
-20
lines changed

src/backend/parser/gram.y

Lines changed: 3 additions & 8 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.77 1999/05/17 01:01:06 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.78 1999/05/19 17:53:10 momjian Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -3403,13 +3403,8 @@ Character: character '(' Iconst ')'
34033403

34043404
if ($3 < 1)
34053405
elog(ERROR,"length for '%s' type must be at least 1",$1);
3406-
else if ($3 > 4096)
3407-
/* we can store a char() of length up to the size
3408-
* of a page (8KB) - page headers and friends but
3409-
* just to be safe here... - ay 6/95
3410-
* XXX note this hardcoded limit - thomas 1997-07-13
3411-
*/
3412-
elog(ERROR,"length for type '%s' cannot exceed 4096",$1);
3406+
else if ($3 > BLCKSZ - 128)
3407+
elog(ERROR,"length for type '%s' cannot exceed %d",$1, BLCKSZ-128);
34133408

34143409
/* we actually implement this sort of like a varlen, so
34153410
* 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.44 1999/05/03 19:10:02 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.45 1999/05/19 17:53:11 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -81,8 +81,8 @@ bpcharin(char *s, int dummy, int32 atttypmod)
8181
else
8282
len = atttypmod - VARHDRSZ;
8383

84-
if (len > 4096)
85-
elog(ERROR, "bpcharin: length of char() must be less than 4096");
84+
if (len > BLCKSZ - 128)
85+
elog(ERROR, "bpcharin: length of char() must be less than %d",BLCKSZ-128);
8686

8787
result = (char *) palloc(atttypmod);
8888
VARSIZE(result) = atttypmod;
@@ -151,8 +151,8 @@ bpchar(char *s, int32 len)
151151

152152
rlen = len - VARHDRSZ;
153153

154-
if (rlen > 4096)
155-
elog(ERROR, "bpchar: length of char() must be less than 4096");
154+
if (rlen > BLCKSZ - 128)
155+
elog(ERROR, "bpchar: length of char() must be less than %d",BLCKSZ-128);
156156

157157
#ifdef STRINGDEBUG
158158
printf("bpchar- convert string length %d (%d) ->%d (%d)\n",
@@ -330,8 +330,8 @@ varcharin(char *s, int dummy, int32 atttypmod)
330330
if (atttypmod != -1 && len > atttypmod)
331331
len = atttypmod; /* clip the string at max length */
332332

333-
if (len > 4096)
334-
elog(ERROR, "varcharin: length of char() must be less than 4096");
333+
if (len > BLCKSZ - 128)
334+
elog(ERROR, "varcharin: length of char() must be less than %d",BLCKSZ-128);
335335

336336
result = (char *) palloc(len);
337337
VARSIZE(result) = len;
@@ -398,8 +398,8 @@ varchar(char *s, int32 slen)
398398
len = slen - VARHDRSZ;
399399
#endif
400400

401-
if (len > 4096)
402-
elog(ERROR, "varchar: length of varchar() must be less than 4096");
401+
if (len > BLCKSZ-128)
402+
elog(ERROR, "varchar: length of varchar() must be less than BLCKSZ-128");
403403

404404
result = (char *) palloc(slen);
405405
VARSIZE(result) = slen;

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3355,13 +3355,12 @@ Character: character '(' Iconst ')'
33553355
sprintf(errortext, "length for '%s' type must be at least 1",$1);
33563356
yyerror(errortext);
33573357
}
3358-
else if (atol($3) > 4096) {
3358+
else if (atol($3) > BLCKSZ - 128) {
33593359
/* we can store a char() of length up to the size
33603360
* of a page (8KB) - page headers and friends but
33613361
* just to be safe here... - ay 6/95
3362-
* XXX note this hardcoded limit - thomas 1997-07-13
33633362
*/
3364-
sprintf(errortext, "length for type '%s' cannot exceed 4096",$1);
3363+
sprintf(errortext, "length for type '%s' cannot exceed %d",BLCKSZ-128);
33653364
yyerror(errortext);
33663365
}
33673366

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy