1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-21 16:02:15 +03:00

Implement following item in TODO:

* Reject character sequences those are not valid in their charset
This commit is contained in:
Tatsuo Ishii
2001-09-11 05:18:59 +00:00
parent 95dc7785b5
commit 7e99cea816
2 changed files with 22 additions and 2 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.81 2001/07/15 11:07:37 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.82 2001/09/11 05:18:59 ishii Exp $
*
*-------------------------------------------------------------------------
*/
@ -75,10 +75,14 @@ bpcharin(PG_FUNCTION_ARGS)
int i;
#ifdef MULTIBYTE
int charlen; /* number of charcters in the input string */
char *ermsg;
#endif
len = strlen(s);
#ifdef MULTIBYTE
if ((ermsg = pg_verifymbstr(s, len)))
elog(ERROR,"%s",ermsg);
charlen = pg_mbstrlen(s);
#endif
@ -405,8 +409,15 @@ varcharin(PG_FUNCTION_ARGS)
int32 atttypmod = PG_GETARG_INT32(2);
VarChar *result;
size_t len, maxlen;
#ifdef MULTIBYTE
char *ermsg;
#endif
len = strlen(s);
#ifdef MULTIBYTE
if ((ermsg = pg_verifymbstr(s, len)))
elog(ERROR,"%s",ermsg);
#endif
maxlen = atttypmod - VARHDRSZ;
if (atttypmod >= (int32) VARHDRSZ && len > maxlen)