-
Notifications
You must be signed in to change notification settings - Fork 64
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
Add hook in select_common_type for CHAR/NCHAR case #140
Merged
forestkeeper
merged 20 commits into
babelfish-for-postgresql:BABEL_3_X_DEV__PG_15_X
from
amazon-aurora:3392-union-char-null
Sep 25, 2023
Merged
Add hook in select_common_type for CHAR/NCHAR case #140
forestkeeper
merged 20 commits into
babelfish-for-postgresql:BABEL_3_X_DEV__PG_15_X
from
amazon-aurora:3392-union-char-null
Sep 25, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wboettge
force-pushed
the
3392-union-char-null
branch
from
June 8, 2023 15:48
fd5cded
to
41c178a
Compare
wboettge
force-pushed
the
3392-union-char-null
branch
from
August 7, 2023 19:45
41c178a
to
9f6d7be
Compare
With distinct, Postgres coerces the type of unknown-typed targets so it may find an equality function. It selects TEXT as the type to coerce to. The problem in T-SQL is if we are unioning the result of SELECT DISTINCT NULL with a different type. Some types, BIT for example, do not have conversion functions between TEXT. Therefore, SELECT CAST(1 as BIT) UNION SELECT DISTINCT NULL fails unexpectantly in Babelfish. This change coerces NULL values to INT4 instead of TEXT when using Babelfish, fixing the result type and the union behavior. Signed-off-by: Walt Boettge <[email protected]>
When unioning NCHAR with CHAR or NULL, the wrong output type is chosen. This hook will cause select_common_type to to pick NCHAR as the result type instead of CHAR in these cases. Signed-off-by: Walt Boettge <[email protected]>
Signed-off-by: Walt Boettge <[email protected]>
Signed-off-by: Walt Boettge <[email protected]>
Signed-off-by: Walt Boettge <[email protected]>
Signed-off-by: Walt Boettge <[email protected]>
wboettge
force-pushed
the
3392-union-char-null
branch
from
August 9, 2023 21:37
dfdfa5b
to
77a5b98
Compare
This reverts commit 77a5b98.
…392-union-char-null
Signed-off-by: Walt Boettge <[email protected]>
This reverts commit 0c08818.
Leaves in literal to varchar typmod handling, plan to remove Signed-off-by: Walt Boettge <[email protected]>
…o 3392-union-char-null
Signed-off-by: Walt Boettge <[email protected]>
…392-union-char-null
Signed-off-by: Walt Boettge <[email protected]>
Signed-off-by: Walt Boettge <[email protected]>
Signed-off-by: Walt Boettge <[email protected]>
…392-union-char-null
Signed-off-by: Walt Boettge <[email protected]>
Signed-off-by: Walt Boettge <[email protected]>
forestkeeper
approved these changes
Sep 25, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
forestkeeper
merged commit Sep 25, 2023
b327d84
into
babelfish-for-postgresql:BABEL_3_X_DEV__PG_15_X
Sairakan
pushed a commit
to amazon-aurora/postgresql_modified_for_babelfish
that referenced
this pull request
Nov 16, 2023
…tgresql#140) * Fix SELECT DISTINCT NULL result type With distinct, Postgres coerces the type of unknown-typed targets so it may find an equality function. It selects TEXT as the type to coerce to. The problem in T-SQL is if we are unioning the result of SELECT DISTINCT NULL with a different type. Some types, BIT for example, do not have conversion functions between TEXT. Therefore, SELECT CAST(1 as BIT) UNION SELECT DISTINCT NULL fails unexpectantly in Babelfish. This change coerces NULL values to INT4 instead of TEXT when using Babelfish, fixing the result type and the union behavior. Signed-off-by: Walt Boettge <[email protected]> Task: BABEL-3348, BABEL-3392, BABEL-4157, BABEL-1874
priyansx
pushed a commit
to amazon-aurora/postgresql_modified_for_babelfish
that referenced
this pull request
Nov 22, 2023
…tgresql#140) * Fix SELECT DISTINCT NULL result type With distinct, Postgres coerces the type of unknown-typed targets so it may find an equality function. It selects TEXT as the type to coerce to. The problem in T-SQL is if we are unioning the result of SELECT DISTINCT NULL with a different type. Some types, BIT for example, do not have conversion functions between TEXT. Therefore, SELECT CAST(1 as BIT) UNION SELECT DISTINCT NULL fails unexpectantly in Babelfish. This change coerces NULL values to INT4 instead of TEXT when using Babelfish, fixing the result type and the union behavior. Signed-off-by: Walt Boettge <[email protected]> Task: BABEL-3348, BABEL-3392, BABEL-4157, BABEL-1874
staticlibs
pushed a commit
to wiltondb/postgresql_modified_for_babelfish
that referenced
this pull request
Jun 23, 2024
…tgresql#140) * Fix SELECT DISTINCT NULL result type With distinct, Postgres coerces the type of unknown-typed targets so it may find an equality function. It selects TEXT as the type to coerce to. The problem in T-SQL is if we are unioning the result of SELECT DISTINCT NULL with a different type. Some types, BIT for example, do not have conversion functions between TEXT. Therefore, SELECT CAST(1 as BIT) UNION SELECT DISTINCT NULL fails unexpectantly in Babelfish. This change coerces NULL values to INT4 instead of TEXT when using Babelfish, fixing the result type and the union behavior. Signed-off-by: Walt Boettge <[email protected]> Task: BABEL-3348, BABEL-3392, BABEL-4157, BABEL-1874
forestkeeper
pushed a commit
to amazon-aurora/postgresql_modified_for_babelfish
that referenced
this pull request
Jul 24, 2024
Previously in the pr : babelfish-for-postgresql#140 We modified the union corece behavior of union select in babelfish, but a typo wrongly changed the postgres behavior and caused a regression, we'll fix the typo in this commit. Signed-off-by: Zhibai Song <[email protected]> Task: MANFRED-22834
1 task
forestkeeper
added a commit
that referenced
this pull request
Jul 25, 2024
* Fix a regression issue caused by typo in union modification Previously in the pr : #140 We modified the union corece behavior of union select in babelfish, but a typo wrongly changed the postgres behavior and caused a regression, we'll fix the typo in this commit. Signed-off-by: Zhibai Song <[email protected]> Task: MANFRED-22834
forestkeeper
added a commit
to amazon-aurora/postgresql_modified_for_babelfish
that referenced
this pull request
Jul 25, 2024
…h-for-postgresql#416) * Fix a regression issue caused by typo in union modification Previously in the pr : babelfish-for-postgresql#140 We modified the union corece behavior of union select in babelfish, but a typo wrongly changed the postgres behavior and caused a regression, we'll fix the typo in this commit. Signed-off-by: Zhibai Song <[email protected]> Task: MANFRED-22834
1 task
forestkeeper
added a commit
that referenced
this pull request
Jul 25, 2024
Previously in the pr : #140 We modified the union corece behavior of union select in babelfish, but a typo wrongly changed the postgres behavior and caused a regression, we'll fix the typo in this commit. Task: MANFRED-22834 Signed-off-by: Zhibai Song <[email protected]>
staticlibs
pushed a commit
to wiltondb/postgresql_modified_for_babelfish
that referenced
this pull request
Oct 8, 2024
…h-for-postgresql#417) Previously in the pr : babelfish-for-postgresql#140 We modified the union corece behavior of union select in babelfish, but a typo wrongly changed the postgres behavior and caused a regression, we'll fix the typo in this commit. Task: MANFRED-22834 Signed-off-by: Zhibai Song <[email protected]>
roshan0708
pushed a commit
to amazon-aurora/postgresql_modified_for_babelfish
that referenced
this pull request
Oct 15, 2024
…abelfish-for-postgresql#416) * Fix a regression issue caused by typo in union modification Previously in the pr : babelfish-for-postgresql#140 We modified the union corece behavior of union select in babelfish, but a typo wrongly changed the postgres behavior and caused a regression, we'll fix the typo in this commit. Signed-off-by: Zhibai Song <[email protected]> Task: MANFRED-22834
shardgupta
pushed a commit
to amazon-aurora/postgresql_modified_for_babelfish
that referenced
this pull request
Nov 8, 2024
…h-for-postgresql#416) * Fix a regression issue caused by typo in union modification Previously in the pr : babelfish-for-postgresql#140 We modified the union corece behavior of union select in babelfish, but a typo wrongly changed the postgres behavior and caused a regression, we'll fix the typo in this commit. Signed-off-by: Zhibai Song <[email protected]> Task: MANFRED-22834
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently, babelfish gives an error when UNION is used with fixed-length types of different lengths or null. This change fixes how types and typmods are handled within UNION and VALUES via two new hooks. It also prevents the early-coercion of UNKNOWNs to handle NULL and string literals.
Issues Resolved
BABEL-3348, BABEL-3392, BABEL-4157
Check List
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.