You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found while diffing the imported PMSYS DD against SAP: stored-proc and
function bodies came back truncated, and every imported proc was missing
its opening statement. Two distinct bugs, neither in DD storage (which
held full bodies all along):
1. Catalog truncation (ace_exports.cpp): build_system_table declared
system.storedprocedures PROCEDURE and system.functions FUNC_BODY as
fixed CHAR(255) — a 5359-byte body (pmsys sp_SaveIntoAuditLog) came
back as a 255-byte prefix. system.triggers CONTAINER C(4096) and
system.views VIEW_SQL C(250) had the same class of cap. Fix: build the
rows first and size the text columns to the longest actual value
(new fit_width helper, clamped under the 64 KB record limit).
2. SAP-binary proc parser dropped each body's FIRST LINE
(data_dict.cpp): the parser located the body by scanning forward to
the first CRLF — but the first CRLF is the END of line 1, so e.g.
sp_GetPhysicalPath lost "DECLARE @SQL STRING;". Hex-dumping pmsys.add
shows the real layout after the params:
[le16 invoke_option][le32 reserved][le16 body_len][body...], with the
inline zone holding the first bytes and the .am continuation exactly
the rest. Parse that structurally (body_len is authoritative — no
CRLF/printable-scan heuristics), keeping the old scan as a fallback
for layouts that don't match.
Verified against PMSYS with SAP ACE as oracle: after re-import, all 7
stored-proc bodies and all 8 comparable function bodies byte-match
SAP's system.* output (whitespace-normalized).
Regression tests:
- data_dict_test.cpp "DataDict SAP-binary proc parse keeps the body's
first line" — fabricates a minimal SAP-binary .add with a structured
Procedure record; fails on the old CRLF scan.
- abi_dd_proc_view_test.cpp "system.storedprocedures returns >255-byte
bodies untruncated".
Note: proc/UDF EXECUTION on the imported DD still has gaps (nested UDF
calls, EXECUTE IMMEDIATE, cursors) — that is the mini-interpreter, a
separate workstream; this commit makes the catalog and parsed bodies
byte-faithful so the interpreter work starts from correct text.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments