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

Fix segfault. Issue #7381 #7554

Merged
merged 6 commits into from
Mar 8, 2024
Merged

Fix segfault. Issue #7381 #7554

merged 6 commits into from
Mar 8, 2024

Conversation

copetol
Copy link
Contributor

@copetol copetol commented Mar 7, 2024

Hi!

DESCRIPTION: Fixes segmentation fault when using CASE WHEN in DO block functions

Fixes #7381

@copetol
Copy link
Contributor Author

copetol commented Mar 7, 2024

@microsoft-github-policy-service agree company="Fors"

@JelteF
Copy link
Contributor

JelteF commented Mar 7, 2024

Thank you for the contribution! On first glance the fix looks reasonable. Could you add a the repro case from the linked issue as a regression test? That way we can make sure we wont re-introduce this issue accidentally in the future.

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Merging #7554 (b8c1870) into main (f0043b6) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7554   +/-   ##
=======================================
  Coverage   89.68%   89.68%           
=======================================
  Files         282      282           
  Lines       60460    60461    +1     
  Branches     7529     7530    +1     
=======================================
+ Hits        54224    54226    +2     
  Misses       4083     4083           
+ Partials     2153     2152    -1     

@copetol
Copy link
Contributor Author

copetol commented Mar 7, 2024

I've added test to multi_schedule, do not know if it is ok, but only there it works

@@ -134,3 +134,5 @@ test: check_mx
test: generated_identity
test: drop_database
test: check_cluster_state

test: function_with_case_when
Copy link
Contributor

@JelteF JelteF Mar 7, 2024

Choose a reason for hiding this comment

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

can you move this test to somewhere above line 125, which contains ensure_no_intermediate_data_leak?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,22 @@
-- create function
Copy link
Contributor

Choose a reason for hiding this comment

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

To avoid leaking objects from one test to another we generally create a dedicated schema for the test and set the search_path accordingly. The easiest way to do that is by running this script: https://github.com/citusdata/citus/blob/main/src/test/regress/bin/create_test.py

end;$$ ;

-- call function
SELECT test_err('test');
Copy link
Contributor

@JelteF JelteF Mar 7, 2024

Choose a reason for hiding this comment

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

Should end with DROP SCHEMA function_with_case

@JelteF JelteF enabled auto-merge (squash) March 8, 2024 13:21
@JelteF JelteF merged commit 12f5643 into citusdata:main Mar 8, 2024
156 of 157 checks passed
emelsimsek pushed a commit that referenced this pull request Mar 11, 2024
When using a CASE WHEN expression in the body
of the function that is used in the DO block, a segmentation
fault occured. This fixes that.

Fixes #7381

---------

Co-authored-by: Konstantin Morozov <vzbdryn@yahoo.com>
@copetol copetol deleted the fix-segfault-7381 branch March 26, 2024 13:48
JelteF pushed a commit that referenced this pull request Apr 16, 2024
When using a CASE WHEN expression in the body
of the function that is used in the DO block, a segmentation
fault occured. This fixes that.

Fixes #7381

---------

Co-authored-by: Konstantin Morozov <vzbdryn@yahoo.com>
(cherry picked from commit 12f5643)
JelteF pushed a commit that referenced this pull request Apr 16, 2024
When using a CASE WHEN expression in the body
of the function that is used in the DO block, a segmentation
fault occured. This fixes that.

Fixes #7381

---------

Co-authored-by: Konstantin Morozov <vzbdryn@yahoo.com>
(cherry picked from commit 12f5643)
JelteF pushed a commit that referenced this pull request Apr 16, 2024
When using a CASE WHEN expression in the body
of the function that is used in the DO block, a segmentation
fault occured. This fixes that.

Fixes #7381

---------

Co-authored-by: Konstantin Morozov <vzbdryn@yahoo.com>
(cherry picked from commit 12f5643)
JelteF pushed a commit that referenced this pull request Apr 16, 2024
When using a CASE WHEN expression in the body
of the function that is used in the DO block, a segmentation
fault occured. This fixes that.

Fixes #7381

---------

Co-authored-by: Konstantin Morozov <vzbdryn@yahoo.com>
(cherry picked from commit 12f5643)
JelteF pushed a commit that referenced this pull request Apr 17, 2024
When using a CASE WHEN expression in the body
of the function that is used in the DO block, a segmentation
fault occured. This fixes that.

Fixes #7381

---------

Co-authored-by: Konstantin Morozov <vzbdryn@yahoo.com>
(cherry picked from commit 12f5643)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault CASE WHEN with DO block
2 participants