Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlcmd hangs for select query with null XML values #1591

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions contrib/babelfishpg_tds/src/backend/tds/tdsresponse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2667,7 +2667,7 @@ TdsPrintTup(TupleTableSlot *slot, DestReceiver *self)
}
}

if (nullMapSize < simpleRowSize)
if (nullMapSize <= simpleRowSize)
{
rowToken = TDS_TOKEN_NBCROW;
}
Expand Down Expand Up @@ -2750,7 +2750,6 @@ TdsPrintTup(TupleTableSlot *slot, DestReceiver *self)
break;
case TDS_TYPE_CHAR:
case TDS_TYPE_NCHAR:
case TDS_TYPE_XML:
case TDS_TYPE_BINARY:

/*
Expand All @@ -2759,6 +2758,14 @@ TdsPrintTup(TupleTableSlot *slot, DestReceiver *self)
*/
TdsPutInt16LE(0xffff);
break;
case TDS_TYPE_XML:

/*
* In case of TDS version lower than or equal to 7.3A,
* we need to send 0xffffffffffffffff (PLP_NULL)
*/
TdsPutUInt64LE(0xffffffffffffffff);
break;
Comment on lines +2768 to +2775
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code where we calculate simpleRowSize needs to be updated according to this. And do we have existing test cases for this? if so please put a reference here and if not then plz add some

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no existing tests for this case, adding them in TestXML test file

case TDS_TYPE_SQLVARIANT:

/*
Expand Down