Skip to content

Support Loading PostgreSQL Function Definitions #84

@aemonge

Description

@aemonge

PugSQL currently skips any .sql file containing DDL or procedural SQL such as
CREATE FUNCTION ... LANGUAGE plpgsql. This means files that define stored
functions are ignored, even if they also include valid query definitions tagged
with -- :name.

Problem

Teams using PostgreSQL functions for business logic cannot expose them through
PugSQL without creating separate thin wrapper files containing a synthetic
SELECT * FROM function(:args) query.

Requested Feature:

Allow PugSQL to recognize and register queries or function calls appearing
after a CREATE FUNCTION block inside the same file.

Optionally provide a config flag such as allow_ddl_statements = true
so database functions can coexist with callable queries.

Benefit:

Makes PugSQL viable for function-centric PostgreSQL apps and aligns with
the HugSQL/YesQL philosophy where stored procedures are first‑class citizens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions