Skip to content

Handling correct typmod for money/smallmoney during coercion and dump-restore #575

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

tanyagupta17
Copy link
Contributor

@tanyagupta17 tanyagupta17 commented May 5, 2025

Description

This PR handles the dump/restore case for smallmoney/money and handles typmod for these dataype while coercing to domain.

Signed-off-by: Tanya Gupta [email protected]

Extension PR : babelfish-for-postgresql/babelfish_extensions#3719

Issues Resolved

BABEL-5512

[List any issues this PR will resolve]

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 PostgreSQL license, 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.

Tanya Gupta added 9 commits April 23, 2025 12:47
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
@rishabhtanwar29
Copy link
Contributor

Please have a better PR title, the title looks different from the changes in the PR.

@tanyagupta17 tanyagupta17 changed the title Handling CASE expression when one branch is of decimal/numeric and other branch is of smallmoney/money. Handling correct typmod for money/smallmoney during dump-restore. May 26, 2025
@tanyagupta17 tanyagupta17 changed the title Handling correct typmod for money/smallmoney during dump-restore. Handling correct typmod for money/smallmoney during dump-restore May 26, 2025
@tanyagupta17 tanyagupta17 changed the title Handling correct typmod for money/smallmoney during dump-restore Handling correct typmod for money/smallmoney during coercion and dump-restore May 26, 2025
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
Signed-off-by: Tanya Gupta <[email protected]>
@tanyagupta17 tanyagupta17 requested review from kuntalghosh and removed request for rohit01010 May 29, 2025 05:45
kuntalghosh
kuntalghosh previously approved these changes May 29, 2025
Signed-off-by: Tanya Gupta <[email protected]>
@tanyagupta17 tanyagupta17 dismissed stale reviews from kuntalghosh and rishabhtanwar29 via 06fe535 June 2, 2025 04:13
jsudrik pushed a commit to babelfish-for-postgresql/babelfish_extensions that referenced this pull request Jun 5, 2025
…her branch is of smallmoney/money. (#3719)

Currently, we treat typmod for smallmoney/money datatype as default which leads to output differences in many cases.

Following are the fixes introduced in this PR :

Introduce typmod handling for smallmoney/money datatype for objects like table/procedure/views/functions/casts and handling their upgrade scenarios.
We are also handling p&s for declared variables, nested case expressions and unions having smallmoney/money as one of it's node.
It also takes case of round vs truncation behaviour around edge cases for fixeddecimal multiplication
Money/smallmoney and Numeric Arithmetic operations - precision and sclae correction and fixing TDS protocol Errors.
T_Param node handling for fixeddecimal dataypes (money and smallmoney) when numeric is another operand.
T_Aggref handling for Sum/Avg for fixeddecimal and other fixed length datatypes when numeric is another operand.
Handing typmod for smallmoney/money in pg catalogs for views metadata and during dump-restore.
Handling money/smallmoney typmod and fixeddecimal typmodin during dump-restore and by-passing typmod while deparsing for ISC check constraint.
Avoiding crashes and wrong results by updating sanity checks and setting intermittent result size appropirately for bigint and fixeddecimal multiplication.
Signed-off-by: Tanya Gupta [email protected]

Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#575
@jsudrik jsudrik merged commit ed82740 into babelfish-for-postgresql:BABEL_5_X_DEV__PG_17_X Jun 5, 2025
2 checks passed
tanyagupta17 added a commit to amazon-aurora/postgresql_modified_for_babelfish that referenced this pull request Jun 6, 2025
…-restore (babelfish-for-postgresql#575)

This PR handles the dump/restore case for smallmoney/money and handles typmod for these dataype while coercing to domain.

Signed-off-by: Tanya Gupta [email protected]

Extension PR : babelfish-for-postgresql/babelfish_extensions#3719

Issues Resolved
BABEL-5512
tanyagupta17 added a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jun 6, 2025
…her branch is of smallmoney/money. (babelfish-for-postgresql#3719)

Currently, we treat typmod for smallmoney/money datatype as default which leads to output differences in many cases.

Following are the fixes introduced in this PR :

Introduce typmod handling for smallmoney/money datatype for objects like table/procedure/views/functions/casts and handling their upgrade scenarios.
We are also handling p&s for declared variables, nested case expressions and unions having smallmoney/money as one of it's node.
It also takes case of round vs truncation behaviour around edge cases for fixeddecimal multiplication
Money/smallmoney and Numeric Arithmetic operations - precision and sclae correction and fixing TDS protocol Errors.
T_Param node handling for fixeddecimal dataypes (money and smallmoney) when numeric is another operand.
T_Aggref handling for Sum/Avg for fixeddecimal and other fixed length datatypes when numeric is another operand.
Handing typmod for smallmoney/money in pg catalogs for views metadata and during dump-restore.
Handling money/smallmoney typmod and fixeddecimal typmodin during dump-restore and by-passing typmod while deparsing for ISC check constraint.
Avoiding crashes and wrong results by updating sanity checks and setting intermittent result size appropirately for bigint and fixeddecimal multiplication.
Signed-off-by: Tanya Gupta [email protected]

Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#575
Yvinayak07 pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jun 6, 2025
…her branch is of smallmoney/money. (babelfish-for-postgresql#3719)

Currently, we treat typmod for smallmoney/money datatype as default which leads to output differences in many cases.

Following are the fixes introduced in this PR :

Introduce typmod handling for smallmoney/money datatype for objects like table/procedure/views/functions/casts and handling their upgrade scenarios.
We are also handling p&s for declared variables, nested case expressions and unions having smallmoney/money as one of it's node.
It also takes case of round vs truncation behaviour around edge cases for fixeddecimal multiplication
Money/smallmoney and Numeric Arithmetic operations - precision and sclae correction and fixing TDS protocol Errors.
T_Param node handling for fixeddecimal dataypes (money and smallmoney) when numeric is another operand.
T_Aggref handling for Sum/Avg for fixeddecimal and other fixed length datatypes when numeric is another operand.
Handing typmod for smallmoney/money in pg catalogs for views metadata and during dump-restore.
Handling money/smallmoney typmod and fixeddecimal typmodin during dump-restore and by-passing typmod while deparsing for ISC check constraint.
Avoiding crashes and wrong results by updating sanity checks and setting intermittent result size appropirately for bigint and fixeddecimal multiplication.
Signed-off-by: Tanya Gupta [email protected]

Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#575
Yvinayak07 pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Jun 6, 2025
…her branch is of smallmoney/money. (babelfish-for-postgresql#3719)

Currently, we treat typmod for smallmoney/money datatype as default which leads to output differences in many cases.

Following are the fixes introduced in this PR :

Introduce typmod handling for smallmoney/money datatype for objects like table/procedure/views/functions/casts and handling their upgrade scenarios.
We are also handling p&s for declared variables, nested case expressions and unions having smallmoney/money as one of it's node.
It also takes case of round vs truncation behaviour around edge cases for fixeddecimal multiplication
Money/smallmoney and Numeric Arithmetic operations - precision and sclae correction and fixing TDS protocol Errors.
T_Param node handling for fixeddecimal dataypes (money and smallmoney) when numeric is another operand.
T_Aggref handling for Sum/Avg for fixeddecimal and other fixed length datatypes when numeric is another operand.
Handing typmod for smallmoney/money in pg catalogs for views metadata and during dump-restore.
Handling money/smallmoney typmod and fixeddecimal typmodin during dump-restore and by-passing typmod while deparsing for ISC check constraint.
Avoiding crashes and wrong results by updating sanity checks and setting intermittent result size appropirately for bigint and fixeddecimal multiplication.
Signed-off-by: Tanya Gupta [email protected]

Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#575
jsudrik pushed a commit that referenced this pull request Jun 6, 2025
…-restore (#575) (#586)

This PR handles the dump/restore case for smallmoney/money and handles typmod for these dataype while coercing to domain.

Signed-off-by: Tanya Gupta [email protected]

Extension PR : babelfish-for-postgresql/babelfish_extensions#3719

Issues Resolved
BABEL-5512
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.

6 participants