Support Loading PostgreSQL Function Definitions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 777
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how .sql files are parsed and how -- :name query definitions are recognized when a CREATE FUNCTION block is present. Define the behavior for registering later queries or function calls and for the optional allow_ddl_statements setting; done means a mixed file exposes its valid callable definitions without being skipped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100