Skip to content

det-port Db2: INSERT ... FOR n ROWS ATOMIC undo via an internal savepoint (Part of #4269) - #7189

Merged
squid-shepherd[bot] merged 4 commits into
mainfrom
churn/4269-20261030T1849Z
Oct 30, 2026
Merged

squid-shepherd[bot] merged 4 commits into
mainfrom
churn/4269-20261030T1849Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #4269.

What

INSERT ... VALUES (:A1, ...) FOR n ROWS (ATOMIC, the default) now undoes the whole statement when a row fails, as Db2 does: SQLERRD(3) is 0 and the SQLCODE is the failing row's. Before, a failure after the first row was refused at run time on both sides.

The port sets an internal savepoint GGINSROWS_UNDO on the unit of work's connection (DetSql.UnitOfWork.execute), rolls back to it and releases it on failure, and releases it on success. Without a unit of work the old refusal stays. The oracle (ggsql.c) runs the same savepoint statements and logs them after the caller's outcome, so the SQL log matches the Java JDBC log in order.

Evidence

  • INSDEMO on Db2: sysout 6/6 equal, GGINS.ITEM table equal, SQL log equal, with two new scenarios (duplicate on row 2, duplicate on the last row).
  • scrolldemo, rowdemo and dynsql proofs still pass.
  • New JDK test test_detsql_insert_rows_undoes_the_rows_before_a_failing_one_with_a_savepoint.
  • pr_gates --fast 9/9, --ratchets 9 pass, audit_check clear, guard tests 211 pass. No golden master is affected (no parser/regex change).

Class / Sibling gaps

Checklist: partial [c:f7800395] -- INSERT FOR n ROWS undo done; scroll cursors (SENSITIVE/DYNAMIC, WITH HOLD) and rowset FETCH with STARTING AT, an orientation, or no FOR n ROWS remain
Checklist: partial [c:005d2c3c] -- the INSERT rowset is now a real unit of work with undo; CICS ROLLBACK stays refused with -926
Checklist: partial [c:022d6a2a] -- Q4 register updated for the INSERT FOR n ROWS form; other forms' Q4 entries unchanged

Sibling gaps (still refused): INSERT ... NOT ATOMIC CONTINUE ON SQLEXCEPTION (needs per-row SQLCA arrays / GET DIAGNOSTICS); rowset FETCH with STARTING AT, an orientation or no FOR n ROWS; SENSITIVE/DYNAMIC scroll cursors; scroll WITH HOLD; CICS ROLLBACK (-926); DESCRIBE, CONNECT and CALL; host-variable arrays outside these two forms.

Remaining slices: NOT ATOMIC CONTINUE; rowset FETCH positioning; sensitive/dynamic and WITH HOLD scroll; CICS ROLLBACK.

Cross-repo: none. Overlaps open PR #7173 (Q4.md, doc-only; edit kept small) and #7178 (cics ggcics*.c, not touched); origin/main merged cleanly.

Lessons for agents

  • DetSql.failed() rethrows non-SQLException errors: a JDK test stub must throw IllegalStateException(new SQLException(msg, state, code)).
  • The Java JDBC log records internal savepoint statements; an oracle that models the same must log them in the same order (after the failing statement).

🤖 Generated with Claude Code

squid-protocol and others added 2 commits October 30, 2026 14:58
…oint (Part of #4269)

A failing row now undoes the whole statement (SQLERRD(3) 0, that row's SQLCODE) on the unit of work, proven on Db2 by INSDEMO.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 30, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review October 30, 2026 19:14
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) October 30, 2026 19:16
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits October 30, 2026 15:33
…849Z

# Conflicts:
#	docs/language_status/register/Q4.md
…ade its asserts unreachable, CodeQL py/unreachable-statement) (Part of #4269)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 30, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit 294b74a into main Oct 30, 2026
59 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/4269-20261030T1849Z branch October 30, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant