Skip to content

test(prepared_statements): avoid corrupting PS after setting number of PS to 0 - #1340

Open
meskill wants to merge 1 commit into
mainfrom
meskill-2026-08-08-fix-prepared_statements---wsp
Open

test(prepared_statements): avoid corrupting PS after setting number of PS to 0#1340
meskill wants to merge 1 commit into
mainfrom
meskill-2026-08-08-fix-prepared_statements---wsp

Conversation

@meskill

@meskill meskill commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

it was fixed already by #1331 but anyway at-least here is integration-like test for this with the helpers to reuse later

@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread pgdog/src/backend/server.rs
Comment thread pgdog/src/backend/server.rs Outdated

/// Run a named statement the way a client would, leaving it to the
/// connection to prepare it first if it isn't already.
pub(crate) async fn execute_prepared(server: &mut Server, name: &str) -> Vec<i64> {

@levkk levkk Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this not taking self? And if we're only using this in tests, let's mark it with cfg(test) as well, especially since this is using hardcoded values. Alternatively, give the caller the ability to pass in params - that will make this method usable by callers for real.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that is also inside the mod test, no self to not mess with the usual impl, and I added the single param to the function so it could be used in more context if needed.

overall, this function is to run the existing prepared when the actual prepared was managed outside, so it's possible to mess around with actual caches etc.

@meskill
meskill force-pushed the meskill-2026-08-08-fix-prepared_statements---wsp branch from bd156b4 to 5f1a2a3 Compare August 11, 2026 18:21
Base automatically changed from meskill-2026-08-10-fix-prepared_statements---vxw to main August 11, 2026 18:51
@meskill
meskill force-pushed the meskill-2026-08-08-fix-prepared_statements---wsp branch from 5f1a2a3 to e48b1aa Compare August 11, 2026 18:51
… PS to 0

- prevent counter reset to avoid newly created prepared statement treated like old one without shape check
- do not clear global hashmap for keys since that could lead to attempt to reuse statement name wiped from global cache
@meskill
meskill force-pushed the meskill-2026-08-08-fix-prepared_statements---wsp branch from e48b1aa to 6806997 Compare August 11, 2026 18:55
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.

2 participants