Challenge passing tests

Which inputs did the passing tests miss?

A salary function can pass for every employee ID in the test data and still return the wrong answer for a fraction. Challenge looks for cases like this in passing functions and procedures that take arguments.

Oracle to PostgreSQL

A fractional ID returns someone’s salary.

  • Employee ID supplied
    Existing employee ID
    Oracle result
    Annual salary
    PostgreSQL result
    Annual salary
  • Employee ID supplied
    Same ID + 0.4
    Oracle result
    NULL
    PostgreSQL result
    Same employee’s salary
  • Employee ID supplied
    Missing ID (−1)
    Oracle result
    NULL
    PostgreSQL result
    NULL

In the HR example, ANNUAL_SALARY takes NUMBER on Oracle and integer on PostgreSQL. Oracle keeps the fraction and finds no matching employee. PostgreSQL rounds the input to the existing ID before the lookup.

What if the proposed call is invalid?

One proposed salary test supplied a parameter named P_ID. The routine takes P_EMPLOYEE_ID. Logic Proof recorded the parameter error and marked the proposal Invalid before execution. It also flags a proposed call whose arguments match an existing test.

Follow a counterexample into the repair process

Look for a difference the existing inputs leave open

The model reads the source routine, the PostgreSQL translation and their parameter definitions. When the project’s data policy permits, it also sees the inputs already tried. A narrower numeric type, a comparison with an empty string or a date converted between time zones gives it a specific reason to propose another call.

Run each new case on both databases

Each proposal gives a value for every input parameter and explains what the case exercises. Logic Proof saves valid new inputs as tests. The source database supplies the expected behavior. Agreement earns a Held result for that case. An observed difference makes it a counterexample and changes the routine’s verdict to Failed. A run that cannot decide records Inconclusive.

Find a smaller input that still reproduces the failure

Logic Proof varies one argument at a time. For a fraction it can try zero and the whole part. For text it can try an empty string and then a shorter string. It runs these variants and records the simplest tested input that still fails. The tests stay with the routine, so a later repair has to pass them.

How to investigate a passing routine

Which routines are worth challenging first?

Look for a passing routine whose interface changed in translation. A narrower numeric argument, a comparison involving NULL and an empty string, or a date near a time-zone boundary gives the model a concrete difference to investigate. A case on either side of that boundary can reveal behavior that typical rows miss.

Start with functions and procedures that take inputs. Tables and views are verified by comparing their rows. The challenge workflow needs a routine it can call with a new argument set.

Who decides what the new test should return?

The proposal supplies parameter values and a reason for trying them. Logic Proof builds the case using the routine’s existing parameter definitions, including types, directions, precision, and scale. It runs the original and translated routines to determine the outcome.

Under a code-and-schema-only policy the model can inspect the declarations and SQL, while existing input values are left out of the model call. The new tests still execute against both staging databases.

What does a smaller counterexample establish?

Logic Proof changes one argument at a time while leaving the others fixed. It can try the whole part of a number or shorten a text input, then rerun the comparison. The simplest tested input that still reproduces the difference gives an engineer a more focused case to debug.

A case that held remains useful, too. It records another input on which the two implementations agreed and stays with the routine when later repairs are tested.

What does your team need to verify?

Tell us which database you’re moving, how far the PostgreSQL code has come, and which behaviors matter most at cutover.

Cookie settings

Choose what Spectral Core can use on this browser. You can change your choices at any time.

Essential storageRemembers your privacy choices.
Always on