mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Fix contrib/hstore to throw an error for keys or values that don't fit in its
data structure, rather than silently truncating them. Andrew Gierth
This commit is contained in:
@ -295,7 +295,7 @@ tconvert(PG_FUNCTION_ARGS)
|
||||
SET_VARSIZE(out, len);
|
||||
out->size = 1;
|
||||
|
||||
ARRPTR(out)->keylen = VARSIZE(key) - VARHDRSZ;
|
||||
ARRPTR(out)->keylen = hstoreCheckKeyLen(VARSIZE(key) - VARHDRSZ);
|
||||
if (PG_ARGISNULL(1))
|
||||
{
|
||||
ARRPTR(out)->vallen = 0;
|
||||
@ -303,7 +303,7 @@ tconvert(PG_FUNCTION_ARGS)
|
||||
}
|
||||
else
|
||||
{
|
||||
ARRPTR(out)->vallen = VARSIZE(val) - VARHDRSZ;
|
||||
ARRPTR(out)->vallen = hstoreCheckValLen(VARSIZE(val) - VARHDRSZ);
|
||||
ARRPTR(out)->valisnull = false;
|
||||
}
|
||||
ARRPTR(out)->pos = 0;
|
||||
@ -540,11 +540,9 @@ hs_contains(PG_FUNCTION_ARGS)
|
||||
res = false;
|
||||
}
|
||||
else if (te->vallen != entry->vallen ||
|
||||
strncmp(
|
||||
vv + entry->pos + entry->keylen,
|
||||
strncmp(vv + entry->pos + entry->keylen,
|
||||
tv + te->pos + te->keylen,
|
||||
te->vallen)
|
||||
)
|
||||
te->vallen))
|
||||
res = false;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user