Skip to main content

Module plpgsql

Module plpgsql 

Source
Expand description

PL/pgSQL function body parser.

Wraps pg_query::parse_plpgsql (libpg_query FFI). Returns a typed PlpgsqlBody so downstream rules can walk the statement list without re-parsing the JSON. Falls back to Err on parse failure or when the pg_query_backend feature is off – callers must be tolerant of that.

The JSON shape libpg_query emits is documented in pl_funcs.c::dump_block; we mirror the subset most rules care about (statement kind + line + body-relative byte offset) and drop the rest into raw for opaque inspection.

Structs§

PlpgsqlBody
PlpgsqlStmt
One statement inside a PL/pgSQL function body.

Enums§

PlpgsqlStmtKind

Functions§

parse
Parse a CREATE FUNCTION ... LANGUAGE plpgsql AS $$ ... $$ body. Pass the full CREATE FUNCTION text – libpg_query expects the surrounding DDL because the function header drives parameter + return-type wiring.