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

Test case with a #[should_panic] for corrupted arrays (requires array mutation) #1540

Open
NotGyro opened this issue Feb 6, 2024 · 0 comments

Comments

@NotGyro
Copy link
Contributor

NotGyro commented Feb 6, 2024

Currently, there is no test case to make sure the debug assertions I'm introducing in Pull Request #1514 actually catch the type of bugs they're intended to catch (see issue #1195).

I'd like to write #[should_fail] tests to make sure that an array which is broken or read incorrectly in certain ways actually does cause a debug build to panic when it should, rather than just going ahead and performing UB.

However, this issue will probably be on the back-burner for a while, since it requires pgrx to support mutating arrays.

Per conversations with @workingjubilee, any test we could write right now that would require mutating a Postgres Array to break it for this purpose would then be such a mess of hacks - unsafe code directly messing with byte-level representation - that its unreadability and unreliability would mean it's not helpful for debugging.

So, writing these test cases will need to wait until after arrays are mutable. However, I don't want to forget it, so I'm setting up this issue now.

@workingjubilee workingjubilee changed the title Test case with a [#should_fail] for corrupted arrays (requires array mutation) Test case with a #[should_fail] for corrupted arrays (requires array mutation) Feb 6, 2024
@workingjubilee workingjubilee changed the title Test case with a #[should_fail] for corrupted arrays (requires array mutation) Test case with a #[should_panic] for corrupted arrays (requires array mutation) Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants