Skip to content

Updated escape logic in quotename#3857

Merged
forestkeeper merged 1 commit intobabelfish-for-postgresql:BABEL_4_X_DEVfrom
amazon-aurora:jira-babel-2311-4x
Jun 23, 2025
Merged

Updated escape logic in quotename#3857
forestkeeper merged 1 commit intobabelfish-for-postgresql:BABEL_4_X_DEVfrom
amazon-aurora:jira-babel-2311-4x

Conversation

@herambh-shah
Copy link
Copy Markdown
Contributor

@herambh-shah herambh-shah commented Jun 19, 2025

Description

Issue Description:

  1. In Babelfish, the QUOTENAME function currently produces incorrect results for many queries due to flaws in its escape character handling logic. The function fails to properly escape characters that match the right delimiter.
  2. Also handle Unicode character handling in delimeter.
  3. Changes logic to accept fetch first character from delimeter string and use it as delimeter

This PR is cherry-pick from 5_X_DEV to 4_X_DEV branch
Cherry -picked PR.

Solution:

  1. The escape logic has been updated to properly handle special characters. Now, when QUOTENAME encounters any character within the input string that matches the right delimiter, it correctly escapes that character.
  2. Updated logic to check byte size instead of len check.

Issues Resolved

BABEL - 2311

Test Scenarios Covered

  • Use case based -
  • Boundary conditions -
  • Arbitrary inputs -

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.

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Jun 19, 2025

Pull Request Test Coverage Report for Build 15793114025

Details

  • 14 of 14 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 75.728%

Totals Coverage Status
Change from base Build 15785133586: -0.001%
Covered Lines: 49181
Relevant Lines: 64944

💛 - Coveralls

Signed-off-by: Herambh Shah <herambhs@amazon.com>
@ayushdsh ayushdsh closed this Jun 20, 2025
@ayushdsh ayushdsh reopened this Jun 20, 2025
@ayushdsh ayushdsh closed this Jun 21, 2025
@herambh-shah herambh-shah reopened this Jun 21, 2025
@herambh-shah herambh-shah marked this pull request as ready for review June 22, 2025 06:34
@forestkeeper forestkeeper merged commit a63a930 into babelfish-for-postgresql:BABEL_4_X_DEV Jun 23, 2025
142 of 144 checks passed
sharathbp pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Sep 22, 2025
Issue Description:

In Babelfish, the QUOTENAME function currently produces incorrect results for many queries due to flaws in its escape character handling logic. The function fails to properly escape characters that match the right delimiter.
Also handle Unicode character handling in delimeter.
Changes logic to accept fetch first character from delimeter string and use it as delimeter
This PR is cherry-pick from 5_X_DEV to 4_X_DEV branch: babelfish-for-postgresql#3817

Solution:
The escape logic has been updated to properly handle special characters. Now, when QUOTENAME encounters any character within the input string that matches the right delimiter, it correctly escapes that character.
Updated logic to check byte size instead of len check.

Issues Resolved :BABEL-2311
Signed-off-by: Herambh Shah <herambhs@amazon.com>
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