Skip to content

Fixing typmod handling for COUNT(*) and COUNT_BIG(*). #3768

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

Conversation

Yvinayak07
Copy link
Contributor

@Yvinayak07 Yvinayak07 commented May 16, 2025

1. Issue:

Recursive calls to resolve_numeric_typmod_from_exp, triggered by the is_numeric_cast condition in T_FuncExpr, failed to handle COUNT(*) and COUNT_BIG(*) operations in the T_Aggref node.

In BBF:

1> select count(*) * 1.00 union select 2.00
2> go
----------------------------------------
                                1.000000
                                2.000000 

In TSQL:

1> select count(*) * 1.00 union select 2.00
2> go

----------------
            1.00
            2.00

2. Changes made to fix the issues

Added handling for COUNT(*) and COUNT_BIG(*) aggregates in T_Aggref node

Issues Resolved

Task: BABEL-5886

Authored-by: yashneet vinayak [email protected]
Signed-off-by: yashneet vinayak [email protected]

Test Scenarios Covered

  • Use case based - YES

  • Boundary conditions - YES

  • Arbitrary inputs -

  • Negative test cases -

  • Minor version upgrade tests -

  • Major version upgrade tests -

  • 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.

@coveralls
Copy link
Collaborator

coveralls commented May 16, 2025

Pull Request Test Coverage Report for Build 15465254117

Details

  • 7 of 9 (77.78%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 75.456%

Changes Missing Coverage Covered Lines Changed/Added Lines %
contrib/babelfishpg_tsql/src/pltsql_coerce.c 7 9 77.78%
Totals Coverage Status
Change from base Build 15464616681: 0.002%
Covered Lines: 48786
Relevant Lines: 64655

💛 - Coveralls

Signed-off-by: yashneet vinayak <[email protected]>
yashneet vinayak added 4 commits May 19, 2025 05:32
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
@KushaalShroff KushaalShroff merged commit 95cd5d8 into babelfish-for-postgresql:BABEL_5_X_DEV Jun 10, 2025
47 checks passed
@KushaalShroff KushaalShroff deleted the BABEL-5879-5_X branch June 10, 2025 09:30
Yvinayak07 added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jun 11, 2025
…postgresql#3768)

Issue: Recursive calls to resolve_numeric_typmod_from_exp, triggered by the is_numeric_cast condition in T_FuncExpr, failed to handle COUNT(*) and COUNT_BIG(*) operations in the T_Aggref node.
Changes made to fix the issues: Added handling for COUNT(*) and COUNT_BIG(*) aggregates in T_Aggref node.

Signed-off-by: yashneet vinayak <[email protected]>
Co-authored-by: yashneet vinayak <[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.

5 participants