We provide a custom made service for just drop us a line.
We would be glad to have feedback from you.
Confidential — Public Healthcare · Core Applications
Problem
A stored procedure is not a file. It is a business rule with a control flow, a set of dependencies it never declares, and a habit of calling other procedures that call others. In a system that has been in service for a decade, the procedures are where the business logic actually lives — not in the documentation, which describes what the system was meant to do, but in the branches someone added for a case that never appeared in any specification.
Moving 120,000 lines of that from Sybase to PostgreSQL is not a syntax problem that a converter solves. It is an evidence problem. For each procedure the question is: can you show that the new one does the same thing as the old one, on the paths that matter? With a requirement of full coverage, “it compiles and the happy path works” is not an answer.
The failure mode is specific and quiet. A converter does not refuse. It produces something that parses, and the difference between parsing and equivalent is a branch nobody exercised.
Approach
Four decisions.
Route each construct to a tool that can actually handle it. Bulk DML syntax goes through a rule-based converter. SQL embedded in Java goes through a parser-driven re-expression rather than substring replacement, so the statement is understood before it is rewritten. Constructs no rule covers go to a model working from a knowledge base of already-solved cases — as a proposal, never as a verdict. What remains goes to a person. The routing is explicit because the whole point is to know which of the four produced any given line.
Treat the exception list as the deliverable. Every construct the converter could not handle is a known unknown. The list of them, each with its resolution, is a reusable asset rather than a by-product, and it is the single reason a second estate costs less than the first.
Count branch combinations, not lines. A procedure with two nested decisions has paths that line coverage never visits. The instrument compiles a shadow procedure that records which branches executed, then compares the combination count in source against the combination count in target. A difference in the count is a conversion defect before any test is written.
Harvest the inputs instead of inventing them. Test data written by hand tests the paths its author thought of. The harness collects real argument sets from the system's own logs and replays them against both engines — which is the only way to reach full coverage without writing thousands of cases nobody will maintain.
Figure 1 — Four routes, one gate
Figure 2 — What full coverage of a procedure actually means
How it was run
Six months, in phases, with the estate split so that each phase ended in something runnable rather than in a percentage. A procedure was counted as converted when it had been through the gate — coverage, comparison, sign-off — not when it had been through the converter.
The second estate ran in parallel on the same method: more than two hundred transaction cases executing against PostgreSQL while the old engine was still in service, which turns the migration from a switch into a comparison that can be read.
Comparison was layered deliberately. A result set proves the calculation; table data proves the write; and the execution plan proves the new engine is not quietly scanning a table the old one indexed. Each layer catches a different kind of mistake, and only the third one catches the mistakes that survive functional testing and appear in production under load.
Nested procedures got their own treatment: argument capture at the call boundary, so a child procedure could be tested on its own rather than only through its parent — the difference between testing a procedure and testing whatever happens to reach it.
Figure 3 — Proving equivalence on a live workload
What we delivered
System names, schema and procedure text are withheld. Volumes and method are as delivered.
Impact
120,000 lines in six months, and a second estate running more than two hundred transaction cases in parallel on the new engine.
The line count is the least interesting number on this page. What matters is that for each converted procedure there is a report saying which branches were executed, what was compared, and where the two engines disagreed. That is the difference between a migration and a rewrite you hope is equivalent — and it is the only thing that would survive being asked to prove it.
The exception knowledge base outlived the project. It is now the starting position for the next legacy system, which is how a one-off exercise turns into a practice.
We provide a custom made service for just drop us a line.
We would be glad to have feedback from you.