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

Conversation

Suthapalli-Ramya-satya-vasavi-srija
Copy link
Contributor

@Suthapalli-Ramya-satya-vasavi-srija Suthapalli-Ramya-satya-vasavi-srija commented Jul 4, 2023

Description

Previously the sqlcmd hangs for select query which has null XML value. This commit fixes by sending NbcRowToken when nullMapSize and simpleRowSize are equal. And for older clients of TDS 7.2 where NbcRowToken doesn't exist, sending PLP_NULL(0xffffffffffffffff) specially for variables of type XML.

Issues Resolved

BABEL-4196

Test Scenarios Covered

  • Use case based - Added select queries which contain NULL xml. Inserted values through INSERT command and through prep-exec.

  • Boundary conditions -

  • Arbitrary inputs - Inserted NULL and some value for XML variables.

  • Negative test cases - N/A

  • Minor version upgrade tests - N/A

  • Major version upgrade tests - N/A

  • Performance tests -

  • Tooling impact -

  • Client tests -

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NbcRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML.

Task: BABEL-4196
Signed-off-by: vasavi suthapalli <[email protected]>
@Deepesh125
Copy link
Contributor

It is not clear in the description that we are fixing sender side for XML NULL values. So please update it accordingly

Comment on lines +2761 to +2768
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;
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

@@ -27,3 +27,15 @@ xml
~~END~~

DROP TABLE XML_dt;

CREATE TABLE [dbo].[notification_definition]([id] [bigint] NOT NULL,[name_tx] [nvarchar](200) NOT NULL,[description_tx] [nvarchar](max) NULL,[schedule_xml] [xml] NULL,[default_sender_tx] [nvarchar](200) NULL,[lock_id] [tinyint] NOT NULL,[settings_xml] [xml] NULL,[agency_id] [bigint] NULL)
Copy link
Contributor

Choose a reason for hiding this comment

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

Have a test to insert NULL through prep-exec also

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added tests which insert NULL through prep-exec in the next revision

@Suthapalli-Ramya-satya-vasavi-srija Suthapalli-Ramya-satya-vasavi-srija changed the title sqlcmd hangs for select query with XML colums sqlcmd hangs for select query with XML columns Jul 10, 2023
@Suthapalli-Ramya-satya-vasavi-srija Suthapalli-Ramya-satya-vasavi-srija changed the title sqlcmd hangs for select query with XML columns sqlcmd hangs for select query with null XML values Jul 10, 2023
@Deepesh125 Deepesh125 merged commit ad26beb into babelfish-for-postgresql:BABEL_3_X_DEV Jul 10, 2023
Suthapalli-Ramya-satya-vasavi-srija added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jul 11, 2023
…tgresql#1591)

Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NBCRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML NULL values.

Task: BABEL-4196
Signed-off-by: vasavi suthapalli <[email protected]>
rl626 pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jul 11, 2023
…tgresql#1591)

Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NBCRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML NULL values.

Task: BABEL-4196
Signed-off-by: vasavi suthapalli <[email protected]>
thephantomthief pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jul 17, 2023
…tgresql#1591)

Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NBCRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML NULL values.

Task: BABEL-4196
Signed-off-by: vasavi suthapalli <[email protected]>
Suthapalli-Ramya-satya-vasavi-srija added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Aug 10, 2023
…tgresql#1591)

Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NBCRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML NULL values.

Task: BABEL-4196
Signed-off-by: vasavi suthapalli <[email protected]>
Suthapalli-Ramya-satya-vasavi-srija added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Aug 10, 2023
…tgresql#1591)

Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NBCRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML NULL values.

Task: BABEL-4196
Signed-off-by: vasavi suthapalli <[email protected]>
shardgupta pushed a commit that referenced this pull request Aug 11, 2023
Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NBCRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML NULL values.

Task: BABEL-4196

Signed-off-by: vasavi suthapalli <[email protected]>
shardgupta pushed a commit that referenced this pull request Aug 16, 2023
sqlcmd hangs for select query with null XML values (#1591)

Previously the sqlcmd hangs for select query which has XML columns. This
commit fixes by sending NBCRowToken when nullMapSize is equal to
simpleRowSize. And for older clients of TDS 7.2 where NbcRowToken
doesn't exist should send 0xffffffffffffffff specially for XML NULL values.

Task: BABEL-4196
Signed-off-by: vasavi suthapalli <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants