cybertec-postgresql / poc-plpgsql-analyzer

Proof of concept for tooling to migrate PL/SQL code to PL/pgSQL written in Rust
MIT License
7 stars 0 forks source link

Analyzer: Determine function invocations #92

Open KieranKaelin opened 1 year ago

KieranKaelin commented 1 year ago

Goal

Given a function, procedure, query or trigger,, the analyzer should list each function invocation, including the amount of calls.

Example

CREATE PROCEDURE secure_dml
    IS
BEGIN
  IF
TO_CHAR (SYSDATE, 'HH24:MI') NOT BETWEEN '08:00' AND '18:00'
        OR TO_CHAR (SYSDATE, 'DY') IN ('SAT', 'SUN') THEN
      RAISE_APPLICATION_ERROR (-20205, 'You may only make changes during normal office hours');
END IF;
END secure_dml;

Invocations:

How to demo

Rust and TS tests demonstrate the new analyzer statistics.