aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/varchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/varchar.c')
-rw-r--r--src/backend/utils/adt/varchar.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c
index 02dfe219f54..1ba5f9d9f6c 100644
--- a/src/backend/utils/adt/varchar.c
+++ b/src/backend/utils/adt/varchar.c
@@ -1028,7 +1028,9 @@ hashbpchar(PG_FUNCTION_ARGS)
buf = palloc(bsize + 1);
rsize = pg_strnxfrm(buf, bsize + 1, keydata, keylen, mylocale);
- if (rsize != bsize)
+
+ /* the second call may return a smaller value than the first */
+ if (rsize > bsize)
elog(ERROR, "pg_strnxfrm() returned unexpected result");
/*
@@ -1084,7 +1086,9 @@ hashbpcharextended(PG_FUNCTION_ARGS)
buf = palloc(bsize + 1);
rsize = pg_strnxfrm(buf, bsize + 1, keydata, keylen, mylocale);
- if (rsize != bsize)
+
+ /* the second call may return a smaller value than the first */
+ if (rsize > bsize)
elog(ERROR, "pg_strnxfrm() returned unexpected result");
/*