Skip to content

fix: report successful zero-column Cypher statements as success - #10

Merged
adsharma merged 1 commit into
mainfrom
fix_issue_6
Aug 10, 2026
Merged

fix: report successful zero-column Cypher statements as success#10
adsharma merged 1 commit into
mainfrom
fix_issue_6

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Fixes: #6

ladybug.cypher() is declared RETURNS SETOF record, so callers must supply a column definition list. Statements that legitimately return zero columns -- a data CREATE/MERGE/DELETE without RETURN, or a CALL of a void procedure -- execute successfully in Ladybug and then fail the column-count check in ladybug_bridge_execute_collect() (and the sibling ladybug_bridge_fill_tuplestore_from_query()):

ERROR: ladybug: failed to execute cypher via Ladybug engine
DETAIL: ladybug: column count mismatch: query returns 0 columns, expected 1

The side effect has already landed, so the caller sees an error for a write that in fact succeeded; an autocommit retry would double-apply it (or fail on a duplicate key, surfacing as yet another error).

liblbug reports such statements as success=true with num_columns=0 and no rows-changed count exposed via the C API, so synthesize a result instead of failing:

  • When the caller supplied the conventional single-TEXT status shape ("AS t(ok text)"), return one row carrying "OK" so the caller can confirm the command completed.
  • Otherwise, return an honest empty result set (0 rows), not a false failure.

Genuine column-count mismatches (non-zero, wrong count) still raise the same error as before.

Add an issue #6 regression test that runs the full sequence in one backend against a dedicated store: CREATE NODE TABLE (DDL, status column -- already fine), data CREATE (0 columns -> "OK"), MERGE (0 columns, int column list -> count 0, not error), then MATCH confirming both writes landed.

…error (#6)

ladybug.cypher() is declared RETURNS SETOF record, so callers must
supply a column definition list.  Statements that legitimately return
zero columns -- a data CREATE/MERGE/DELETE without RETURN, or a CALL of
a void procedure -- execute successfully in Ladybug and then fail the
column-count check in ladybug_bridge_execute_collect() (and the sibling
ladybug_bridge_fill_tuplestore_from_query()):

  ERROR: ladybug: failed to execute cypher via Ladybug engine
  DETAIL: ladybug: column count mismatch: query returns 0 columns, expected 1

The side effect has already landed, so the caller sees an error for a
write that in fact succeeded; an autocommit retry would double-apply it
(or fail on a duplicate key, surfacing as yet another error).

liblbug reports such statements as success=true with num_columns=0 and
no rows-changed count exposed via the C API, so synthesize a result
instead of failing:

  - When the caller supplied the conventional single-TEXT status shape
    ("AS t(ok text)"), return one row carrying "OK" so the caller can
    confirm the command completed.
  - Otherwise, return an honest empty result set (0 rows), not a false
    failure.

Genuine column-count mismatches (non-zero, wrong count) still raise the
same error as before.

Add an issue #6 regression test that runs the full sequence in one
backend against a dedicated store: CREATE NODE TABLE (DDL, status
column -- already fine), data CREATE (0 columns -> "OK"), MERGE (0
columns, int column list -> count 0, not error), then MATCH confirming
both writes landed.

Fixes #6.
@adsharma
adsharma merged commit 895cbdb into main Aug 10, 2026
4 checks passed
@adsharma
adsharma deleted the fix_issue_6 branch August 10, 2026 17: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.

Successful zero-column Cypher statements are reported to the caller as errors

1 participant