Skip to content

det: EXEC SQL EXECUTE IMMEDIATE literal INSERT ... VALUES (Part of #4269) - #5415

Merged
squid-protocol merged 1 commit into
mainfrom
churn/4269-20261018T0529Z
Oct 18, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
churn/4269-20261018T0529Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

What changed

EXEC SQL EXECUTE IMMEDIATE '<literal INSERT ... VALUES ...>' now translates (det port). The literal runs as written on the unit of work's connection via the existing DetSql.savepoint path, so Db2 answers. The oracle precompiler (tests/tools/equivalence_sql.py) mirrors it with an independent regex.

Design decision

Scope narrowed from "all non-SELECT" to INSERT ... VALUES with a literal text and no parameter marker. Reason: savepoint sets no row count, and UPDATE/DELETE need the +100 mapping, which means a DetSql.java change that moves every Db2 port. Everything else is refused by name.

Evidence

  • Synthetic estate tests/equivalence/db2/dynsql (DYNDEMO: inserts, doubled quote, -803, WHENEVER + missing table -204): e2e on real Db2 reports proven, trace matches.
  • Assumption: SQLERRD(3) is not set by the port (not shown to matter in any diff).
  • Oracle is GnuCOBOL plus our stub, not z/OS.

Gates

det_port check: 122/122 unchanged. pr_gates --fast 6/6, --ratchets 8/8. Guard + sql tests 211 passed, 2 skipped. time_ratchet: 0 over. equivalence_env --check 10/10. Golden not run (no scanned-engine parsing change).

Sibling gaps

Host-variable text (needs ggsql.c); dynamic UPDATE/DELETE/MERGE/INSERT...SELECT/DDL (needs row count, DetSql.java); PREPARE/EXECUTE USING/DESCRIBE; EXEC SQL CALL; CONNECT; scroll FETCH; host arrays; DSNTIAR/DSNTIAC; EXECUTE IMMEDIATE in CICS.

Lessons for agents

  • A COBOL comment containing "EXEC SQL" is parsed as a statement by the precompiler.
  • Ruff S608 flags SQL-looking message strings in det/sql.py; use a constant message.

🤖 Generated with Claude Code

The literal statement text runs as written on the unit of work's connection
(DetSql.savepoint's path), Db2 answering; the oracle precompiler mirrors it.
Other dynamic SQL forms stay refused by name. Proven on Db2 by the synthetic
estate tests/equivalence/db2/dynsql (DYNDEMO). Q4 register updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 18, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 18, 2026 05:51
@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 18, 2026
@squid-protocol
squid-protocol enabled auto-merge (squash) October 18, 2026 05:53
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit cf4303f into main Oct 18, 2026
85 checks passed
@squid-protocol
squid-protocol deleted the churn/4269-20261018T0529Z branch October 18, 2026 06:32
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