Skip to content

Added support for XML VALUE() datatype method #3771

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

Open
wants to merge 9 commits into
base: BABEL_5_X_DEV
Choose a base branch
from

Conversation

rohit01010
Copy link
Contributor

Description

Currently we do not support XML VALUE() Function. This PR adds the support for XML VALUE() Function.
This support is added by rewriting the query as follows

xml_expression.VALUE(xpath, typename)   ->   bbf_xmlvalue(xpath, typename, xml_expression)

Also, added PostgreSQL grammar which calls internal function bbf_xmlvalue(xpath, xml_expression) which uses underlying PostgreSQL function xpath() to get the required output, and also added a typecast on its result to get the result with type as specified in argument.

Authored-by: Rohit Bhagat [email protected]
Signed-off-by: Rohit Bhagat [email protected]

Issues Resolved

BABEL-5223

Test Scenarios Covered

  • Use case based - YES

  • Boundary conditions - YES

  • Arbitrary inputs - YES

  • Negative test cases - YES

  • Minor version upgrade tests - YES

  • Major version upgrade tests - YES

  • Performance tests - NA

  • Tooling impact - NA

  • Client tests - NA

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.

Rohit Bhagat added 2 commits May 20, 2025 18:38
Signed-off-by: Rohit Bhagat <[email protected]>
@coveralls
Copy link
Collaborator

coveralls commented May 21, 2025

Pull Request Test Coverage Report for Build 15483310692

Details

  • 15 of 15 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.09%) to 75.546%

Totals Coverage Status
Change from base Build 15464616681: 0.09%
Covered Lines: 48847
Relevant Lines: 64659

💛 - Coveralls

Signed-off-by: Rohit Bhagat <[email protected]>
Copy link
Contributor

@Anikait143 Anikait143 left a comment

Choose a reason for hiding this comment

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

Have we verified the case sensitivity of VALUE function with TSQL? Does VALUE, value, Value, etc. all work or there is only a particular case which is valid, if that is the case then we will have to handle that as well!

@@ -38,6 +38,7 @@ PG_KEYWORD("authorization", AUTHORIZATION, TYPE_FUNC_NAME_KEYWORD)
PG_KEYWORD("auto", TSQL_AUTO, UNRESERVED_KEYWORD)
PG_KEYWORD("backward", BACKWARD, UNRESERVED_KEYWORD)
PG_KEYWORD("base64", TSQL_BASE64, UNRESERVED_KEYWORD)
PG_KEYWORD("bbf_xmlvalue", TSQL_XML_VALUE, UNRESERVED_KEYWORD)
Copy link
Contributor

Choose a reason for hiding this comment

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

Category should be RESERVED_KEYWORD

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Copy link
Contributor

Choose a reason for hiding this comment

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

why should it be reserved?

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.

4 participants