Function parse_plpgsql

Source
pub fn parse_plpgsql(stmt: &str) -> Result<Value>
Expand description

An experimental API which parses a PLPGSQL function. This currently returns the raw JSON structure.

ยงExample

let result = pg_query::parse_plpgsql("
    CREATE OR REPLACE FUNCTION cs_fmt_browser_version(v_name varchar, v_version varchar)
    RETURNS varchar AS $$
    BEGIN
        IF v_version IS NULL THEN
            RETURN v_name;
        END IF;
        RETURN v_name || '/' || v_version;
    END;
    $$ LANGUAGE plpgsql;
");
assert!(result.is_ok());