|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.46 1999/05/25 16:12:21 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.47 1999/07/03 00:32:50 momjian Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
14 | 14 | #include<stdio.h>/* for sprintf() */ |
15 | 15 | #include<string.h> |
16 | 16 | #include"postgres.h" |
| 17 | +#include"access/htup.h" |
17 | 18 | #include"utils/array.h" |
18 | 19 | #include"utils/builtins.h" |
19 | 20 | #include"catalog/pg_type.h" |
@@ -81,8 +82,9 @@ bpcharin(char *s, int dummy, int32 atttypmod) |
81 | 82 | else |
82 | 83 | len=atttypmod-VARHDRSZ; |
83 | 84 |
|
84 | | -if (len>BLCKSZ-128) |
85 | | -elog(ERROR,"bpcharin: length of char() must be less than %d",BLCKSZ-128); |
| 85 | +if (len>MaxTupleSize) |
| 86 | +elog(ERROR,"bpcharin: length of char() must be less than %d", |
| 87 | +MaxTupleSize); |
86 | 88 |
|
87 | 89 | result= (char*)palloc(atttypmod); |
88 | 90 | VARSIZE(result)=atttypmod; |
@@ -151,8 +153,9 @@ bpchar(char *s, int32 len) |
151 | 153 |
|
152 | 154 | rlen=len-VARHDRSZ; |
153 | 155 |
|
154 | | -if (rlen>BLCKSZ-128) |
155 | | -elog(ERROR,"bpchar: length of char() must be less than %d",BLCKSZ-128); |
| 156 | +if (rlen>MaxTupleSize) |
| 157 | +elog(ERROR,"bpchar: length of char() must be less than %d", |
| 158 | +MaxTupleSize); |
156 | 159 |
|
157 | 160 | #ifdefSTRINGDEBUG |
158 | 161 | printf("bpchar- convert string length %d (%d) ->%d (%d)\n", |
@@ -332,8 +335,9 @@ varcharin(char *s, int dummy, int32 atttypmod) |
332 | 335 | if (atttypmod!=-1&&len>atttypmod) |
333 | 336 | len=atttypmod;/* clip the string at max length */ |
334 | 337 |
|
335 | | -if (len>BLCKSZ-128) |
336 | | -elog(ERROR,"varcharin: length of char() must be less than %d",BLCKSZ-128); |
| 338 | +if (len>MaxTupleSize) |
| 339 | +elog(ERROR,"varcharin: length of char() must be less than %d", |
| 340 | +MaxTupleSize); |
337 | 341 |
|
338 | 342 | result= (char*)palloc(len); |
339 | 343 | VARSIZE(result)=len; |
@@ -403,8 +407,9 @@ varchar(char *s, int32 slen) |
403 | 407 | len=slen-VARHDRSZ; |
404 | 408 | #endif |
405 | 409 |
|
406 | | -if (len>BLCKSZ-128) |
407 | | -elog(ERROR,"varchar: length of varchar() must be less than BLCKSZ-128"); |
| 410 | +if (len>MaxTupleSize) |
| 411 | +elog(ERROR,"varchar: length of varchar() must be less than %d", |
| 412 | +MaxTupleSize); |
408 | 413 |
|
409 | 414 | result= (char*)palloc(slen); |
410 | 415 | VARSIZE(result)=slen; |
|