From 247409aad94e04e091a4c1720635dddf5761d8e7 Mon Sep 17 00:00:00 2001 From: Amey Pawar <138877912+ameyypawar@users.noreply.github.com> Date: Thu, 9 Jul 2026 07:52:57 +0530 Subject: [PATCH] fix(gucs): report an error instead of panicking on an empty `probes` entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `vchordrq.probes` parser panics via `.expect("empty probes")` when an entry is empty (e.g. `SET vchordrq.probes = ',5'` or `'1,,2'`), even though the sibling match arm already reports malformed input cleanly with `pgrx::error!`. Handle the empty entry the same way — a proper error rather than a panic. Behavior is unchanged for all valid input. --- src/index/gucs.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index/gucs.rs b/src/index/gucs.rs index 8c0e9fd3..f2724593 100644 --- a/src/index/gucs.rs +++ b/src/index/gucs.rs @@ -388,7 +388,10 @@ pub unsafe fn vchordrq_probes(index: pgrx::pg_sys::Relation) -> Vec { for &c in value.to_bytes() { match c { b' ' => continue, - b',' => result.push(current.take().expect("empty probes")), + b',' => match current.take() { + Some(value) => result.push(value), + None => pgrx::error!("empty entry in probes"), + }, b'0'..=b'9' => { if let Some(x) = current.as_mut() { *x = *x * 10 + (c - b'0') as u32;