Skip to content

Commit

Permalink
Refactor the nullmap size logic and add rowstat column to size calc
Browse files Browse the repository at this point in the history
Signed-off-by: Nirmit Shah <[email protected]>
  • Loading branch information
Nirmit Shah committed Jan 18, 2024
1 parent fb067e4 commit cbfda94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,13 @@ TdsPrintTup(TupleTableSlot *slot, DestReceiver *self)
* NBCROW (0xD2). Count the number of nullable columns and build the
* null bitmap just in case while we are at it.
*/
nullMapSize = (natts + 7) / 8;

if (sendRowStat)
/* Extra bit for the ROWSTAT column */
nullMapSize = (natts >> 3) + 1;
else
nullMapSize = ((natts - 1) >> 3) + 1;

nullMap = palloc0(nullMapSize);
MemSet(nullMap, 0, nullMapSize * sizeof(int8_t));
for (attno = 0; attno < natts; attno++)
Expand Down

0 comments on commit cbfda94

Please sign in to comment.