Skip to content

Reserved words as generated column / table names are quoted (#4037); tools import their own checkout - #4066

Merged
squid-protocol merged 2 commits into
mainfrom
fix/jpa-reserved-columns-4037
Oct 1, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/jpa-reserved-columns-4037

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #4037.

A COBOL item or record named CURRENT-DATE, USER, ORDER, KEY or YEAR became a column or table with that exact name, and the database refused the DDL. Every CardDemo project logged Error executing DDL ... current_date integer ... expected identifier on H2. As a result PENDING_AUTH_DETAILS was never created, and any repository call on it would have failed.

Fix

  • cobol_to_java_names.SQL_RESERVED: 175 words that are reserved, or are keywords an identifier may not be, in the databases the generator targets: the SQL standard's core; H2 2.x (KEY, VALUE, YEAR, MONTH, DAY); PostgreSQL; and the DB2, MySQL and Oracle words a COBOL data name plausibly takes.
  • sql_name() quotes such a name in the annotation (@Column(name = "\"CURRENT_DATE\"")). The database then takes it as a plain identifier, and Hibernate uses the quoted name in every statement. Every other name is unchanged.
  • Both entity forges (schema entities and VSAM entities) use it for columns, tables and collection tables.

Verified on H2: the CardDemo dateutil proof logs 0 DDL errors (2 before) and stays proven. The CardDemo full-corpus snapshot is re-blessed: the one column changes, plus that file's hash in the guardrail inventory.

A tool bug this exposed (separate commit)

refraction_snapshot.py, tool_regex_redos.py and span_anchor_audit.py imported gitgalaxy before putting their own checkout on sys.path. Run as a script, the import resolved to whatever gitgalaxy the interpreter had installed, here another checkout's editable install. So refraction_snapshot.py update "blessed" the other checkout's output, check agreed with it, and pytest failed. CI installs its own checkout, so only local runs were affected. The fix moves those imports after the insert.

Tests: tests/cobol_mainframe/test_sql_reserved_names.py covers quoting versus no quoting, the issue's words, and an entity with a reserved table and columns. The snapshot and ReDoS tool tests pass, and audit_check is clear.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ

squid-protocol and others added 2 commits September 30, 2026 22:54
refraction_snapshot.py, tool_regex_redos.py and span_anchor_audit.py
imported gitgalaxy before inserting their repository root. Run as a
script, sys.path starts at tests/tools, so the import resolved to
whatever gitgalaxy the interpreter had installed -- another checkout's
editable install -- and the tool measured that one. Found by
`refraction_snapshot.py update`: it "blessed" the other checkout's
generator output, and `check` then agreed with it, while pytest (which
imports this checkout) failed. CI installs its own checkout, so only
local runs were affected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
A COBOL item or record named CURRENT-DATE, USER, ORDER, KEY or YEAR
became a column or table of that name, and the database refused the DDL:
every CardDemo project logged "Error executing DDL ... current_date
integer ... expected identifier" on H2, so PENDING_AUTH_DETAILS was never
created and any repository call on it would fail.

- cobol_to_java_names.SQL_RESERVED: the words reserved, or keywords an
  identifier may not be, in the databases the generator targets (the SQL
  standard's core, H2 2.x -- KEY, VALUE, YEAR, MONTH, DAY --, PostgreSQL,
  and DB2 / MySQL / Oracle words a COBOL data name plausibly takes).
- sql_name(): such a name is quoted in the annotation
  (`@Column(name = "\"CURRENT_DATE\"")`); the database takes it as a plain
  identifier and Hibernate uses the quoted name in every statement. Every
  other name is unchanged.
- Both entity forges (the schema entities and the VSAM entities) use it
  for columns, tables and collection tables.

Verified on H2: the CardDemo dateutil proof logs 0 DDL errors (2 before)
and stays proven. The CardDemo full-corpus snapshot is re-blessed: the one
column, and that file's hash in the guardrail inventory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 5f0830e into main Oct 1, 2026
39 checks passed
@squid-protocol
squid-protocol deleted the fix/jpa-reserved-columns-4037 branch October 1, 2026 09:22
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.

Generated JPA entity uses SQL reserved words as column names (CURRENT-DATE -> current_date): the table is not created on H2

1 participant