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

Commitc098f30

Browse files
committed
Rollback varchar size change.
1 parent1c9fcfb commitc098f30

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

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

Lines changed: 24 additions & 5 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.18 1998/01/07 22:08:23 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.19 1998/01/08 03:05:01 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -132,8 +132,11 @@ varcharin(char *s, int dummy, int typlen)
132132
if (s==NULL)
133133
return ((char*)NULL);
134134

135-
len=strlen(s)+VARHDRSZ;
136-
if (typlen!=-1&&len>typlen)
135+
if (typelen==-1)/* we will remove this soon to make compact storage */
136+
/* change varcharlen at the same time to use VARSIZE */
137+
len=strlen(s)+VARHDRSZ;
138+
/*if (typlen != -1 && len > typlen) */
139+
else
137140
len=typlen;/* clip the string at max length */
138141

139142
if (len>4096)
@@ -194,7 +197,7 @@ bpcharlen(char *arg)
194197
elog(ERROR,"Bad (null) char() external representation",NULL);
195198

196199
return(bcTruelen(arg));
197-
}/* bpcharlen() */
200+
}
198201

199202
bool
200203
bpchareq(char*arg1,char*arg2)
@@ -327,13 +330,29 @@ bpcharcmp(char *arg1, char *arg2)
327330
*Comparison Functions used for varchar
328331
*****************************************************************************/
329332

333+
staticint
334+
vcTruelen(char*arg)
335+
{
336+
char*s=arg+VARHDRSZ;
337+
inti;
338+
intlen;
339+
340+
len=*(int32*)arg-VARHDRSZ;
341+
for (i=0;i<len;i++)
342+
{
343+
if (*s++=='\0')
344+
break;
345+
}
346+
returni;
347+
}
348+
330349
int32
331350
varcharlen(char*arg)
332351
{
333352
if (!PointerIsValid(arg))
334353
elog(ERROR,"Bad (null) varchar() external representation",NULL);
335354

336-
returnVARSIZE(arg)-VARHDRSZ;
355+
return(vcTruelen(arg));
337356
}
338357

339358
bool

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp