Skip to content

Commit b35f92b

Browse files
emanzxfarhan-syah
authored andcommitted
docs: state expression-error constraints in code terms
Drop tracker references from the comments introduced by this change so the source reads standalone. Comment-only; no executable line, string literal, or test assertion is modified.
1 parent b1d18d0 commit b35f92b

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

nodedb/src/control/planner/procedural/executor/eval.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ use crate::control::state::SharedState;
1313
use crate::types::TenantId;
1414

1515
/// Signal from constant-expression evaluation that a `/` or `%` reached a
16-
/// zero divisor (nodedb issue #227).
16+
/// zero divisor.
1717
///
1818
/// Kept local to this module — the procedural executor's constant folder is
1919
/// a separate, sqlparser-based tree-walk evaluator with no dependency on
2020
/// `nodedb_query` (whose own `EvalError::DivisionByZero`, from the
21-
/// DataFusion-backed row-expression evaluator fixed under issue #216,
22-
/// covers a different code path entirely). Every other historically
23-
/// `None`-folding case (unknown identifiers, unsupported operators,
24-
/// overflow, non-finite float results) is unaffected and keeps folding to
25-
/// `Ok(None)` — see `try_eval_constant`, `evaluate_to_value`.
21+
/// DataFusion-backed row-expression evaluator, covers a different code path
22+
/// entirely). Every other historically `None`-folding case (unknown
23+
/// identifiers, unsupported operators, overflow, non-finite float results)
24+
/// is unaffected and keeps folding to `Ok(None)` — see `try_eval_constant`,
25+
/// `evaluate_to_value`.
2626
#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
2727
enum ConstEvalError {
2828
#[error("division by zero")]
@@ -127,7 +127,7 @@ pub async fn evaluate_to_value(
127127
/// (unparseable input, unknown identifiers, unsupported operators,
128128
/// overflow) — callers fold that to `Value::Null`, matching historical
129129
/// behavior. Returns `Err(ConstEvalError::DivisionByZero)` only when
130-
/// evaluation reaches a `/` or `%` with a zero divisor (nodedb issue #227).
130+
/// evaluation reaches a `/` or `%` with a zero divisor.
131131
fn try_eval_constant(sql: &str) -> Result<Option<nodedb_types::Value>, ConstEvalError> {
132132
let trimmed = sql.trim();
133133
let expr_str = if trimmed.to_uppercase().starts_with("SELECT ") {
@@ -275,7 +275,7 @@ fn eval_binary_op(
275275
mod tests {
276276
use super::*;
277277

278-
// ── Division/modulo by zero (nodedb issue #227) ─────────────────────────
278+
// ── Division/modulo by zero ─────────────────────────────────────────────
279279

280280
#[test]
281281
fn integer_division_by_zero_signals_error() {

nodedb/src/error.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ pub enum Error {
201201
UndefinedFunction { name: String },
202202

203203
/// Expression evaluation divided or took a modulus by zero. Propagated
204-
/// from `nodedb_query::EvalError::DivisionByZero`; the pgwire layer
204+
/// from the row-expression evaluator (`nodedb_query::EvalError::DivisionByZero`)
205+
/// and the procedural executor's constant folder; the pgwire layer
205206
/// renders this as SQLSTATE `22012` (division_by_zero).
206207
#[error("division by zero")]
207208
DivisionByZero,

nodedb/tests/trigger_e2e.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ async fn before_trigger_reject_does_not_persist_row() {
9999

100100
/// A BEFORE INSERT trigger that divides by zero in a NEW.* assignment must
101101
/// reject the insert with a "division by zero" error instead of silently
102-
/// writing NULL (nodedb issue #227), and the row must NOT be persisted —
103-
/// the same fail-closed contract as any other BEFORE trigger rejection.
102+
/// writing NULL, and the row must NOT be persisted — the same fail-closed
103+
/// contract as any other BEFORE trigger rejection.
104104
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
105105
async fn before_trigger_division_by_zero_rejects_insert() {
106106
let server = TestServer::start().await;

0 commit comments

Comments
 (0)