Skip to content

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

Merged
jsudrik merged 1 commit into
babelfish-for-postgresql:BABEL_4_X_DEV__PG_16_Xfrom
amazon-aurora:babel_5512_4x
Jun 6, 2025
Merged

Handling correct typmod for money/smallmoney during coercion and dump-restore#586
jsudrik merged 1 commit into
babelfish-for-postgresql:BABEL_4_X_DEV__PG_16_Xfrom
amazon-aurora:babel_5512_4x

Conversation

@tanyagupta17

@tanyagupta17 tanyagupta17 commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

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 tanyagp@amazon.com

Cherry-pick PR : #575
Extension PR : babelfish-for-postgresql/babelfish_extensions#3808

Issues Resolved

BABEL-5512

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.

…-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 tanyagp@amazon.com

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

Issues Resolved
BABEL-5512

@jsudrik jsudrik left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved. Cherrypick from the other branch.

@jsudrik
jsudrik merged commit 45fb228 into babelfish-for-postgresql:BABEL_4_X_DEV__PG_16_X Jun 6, 2025
2 checks passed
jsudrik pushed a commit to babelfish-for-postgresql/babelfish_extensions that referenced this pull request Jun 6, 2025
…her branch is of smallmoney/money. (#3808)

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 tanyagp@amazon.com

Cherry-pick PR : #3719
Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#586

Issues Resolved
BABEL-5512, BABEL-5718, BABEL-5889, BABEL-5744, BABEL-5750, BABEL-5755, BABEL-5758, BABEL-5892, BABEL-5893, BABEL-5894, BABEL-5895, BABEL-5896, BABEL-5897, BABEL-5898
sharathbp pushed a commit to amazon-aurora/babelfish_extensions that referenced this pull request Sep 22, 2025
…her branch is of smallmoney/money. (babelfish-for-postgresql#3808)

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 tanyagp@amazon.com

Cherry-pick PR : babelfish-for-postgresql#3719
Engine PR : babelfish-for-postgresql/postgresql_modified_for_babelfish#586

Issues Resolved
BABEL-5512, BABEL-5718, BABEL-5889, BABEL-5744, BABEL-5750, BABEL-5755, BABEL-5758, BABEL-5892, BABEL-5893, BABEL-5894, BABEL-5895, BABEL-5896, BABEL-5897, BABEL-5898
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