Syntax
CREATE PROCEDURE
features:
- Schema-qualified names: Procedures can be defined in specific schemas
- Parameters:
- IN, OUT, INOUT parameter modes
- Default parameter values
- Named parameters with data types
- Languages: Any PostgreSQL procedural language (plpgsql, sql, c, internal, etc.)
- Procedure body: Any valid procedure definition with proper dollar-quoting
Canonical Format
When generating migration SQL, pgschema produces procedures in the following canonical format:- Always uses
CREATE OR REPLACE PROCEDURE
for modifications - Parameters are formatted with line breaks for readability when multiple parameters exist
- Uses intelligent dollar-quoting with automatic tag generation to avoid conflicts with procedure body content
- For DROP operations:
DROP PROCEDURE IF EXISTS procedure_name(parameter_types);
- The parameter_types in DROP statements contain only the data types, not parameter names