Skip to content

Commit

Permalink
bpchar's write_datum handler follows atttypmod, to add padding space …
Browse files Browse the repository at this point in the history
…if string is smaller

issue reported at heterodb#746
  • Loading branch information
kaigai committed Apr 2, 2024
1 parent 3ba608d commit e9b228b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/xpu_textlib.cu
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,14 @@ xpu_bpchar_datum_write(kern_context *kcxt,
}
else
{
nbytes = VARHDRSZ + arg->length;
int sz = VARHDRSZ + arg->length;

nbytes = Max(sz, cmeta->atttypmod);
if (buffer)
{
memcpy(buffer+VARHDRSZ, arg->value, arg->length);
if (sz < cmeta->atttypmod)
memset(buffer+sz, ' ', cmeta->atttypmod - sz);
SET_VARSIZE(buffer, nbytes);
}
}
Expand Down

0 comments on commit e9b228b

Please sign in to comment.