Skip to content
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

ExecProcessReturning is unexpectedly called twice for psql request causing overflow error #488

Conversation

hopebo
Copy link
Contributor

@hopebo hopebo commented Nov 28, 2024

Description

In community postgresql, ExecProcessReturning is called once after the
main process of ExecInsert. But due to some merging errors related to
Babelfish and T-SQL, this function is wrongly called twice for psql
requests. At the first call, the xmax is not initialized causing
unexpected error raising.

The first intention of these pieces of codes is to call it in the
first place only for T-SQL(CR-52326143). And then got wrongly
cherry-picked in CR-57250041. Finally, the condition check gets
removed in CR-65026879. We should keep the first intention of the
codes, which also makes it consistent with the behaviour in
ExecUpdate.

Task: BABEL-5343

Issues Resolved

Unexpected error raised for psql requests

CREATE TABLE table1(id SERIAL, col1 VARCHAR UNIQUE);
postgres=# INSERT INTO table1 VALUES (default, 'alma')  RETURNING xmax::text::int;
ERROR:  value "4294967295" is out of range for type integer

Tests

All BabelExtension tests have passed in babelfish-for-postgresql/babelfish_extensions#3189, except one upgrade test failed due to HTTP error.

Postgres regression tests in parallel schedule passed.

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.

…using overflow error

Description
-----------
In community postgresql, ExecProcessReturning is called once after the
main process of ExecInsert. But due to some merging errors related to
Babelfish and T-SQL, this function is wrongly called twice for psql
requests. At the first call, the xmax is not initialized causing
unexpected error raising.

The first intention of these pieces of codes is to call it in the
first place only for T-SQL(CR-52326143). And then got wrongly
cherry-picked in CR-57250041. Finally, the condition check gets
removed in CR-65026879. We should keep the first intention of the
codes, which also makes it consistent with the behaviour in
ExecUpdate.

Task: BABEL-5343
Signed-off-by: Bo Li <[email protected]>
@2jungkook 2jungkook merged commit db4e138 into babelfish-for-postgresql:BABEL_5_X_DEV__PG_17_X Dec 4, 2024
2 checks passed
@2jungkook 2jungkook deleted the jira-babel-5343 branch December 4, 2024 00:20
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