Skip to content

feat: pg statement name generator#29395

Merged
jacek-prisma merged 1 commit intomainfrom
feat/pg-statement-name-generator
Mar 25, 2026
Merged

feat: pg statement name generator#29395
jacek-prisma merged 1 commit intomainfrom
feat/pg-statement-name-generator

Conversation

@jacek-prisma
Copy link
Copy Markdown
Contributor

@jacek-prisma jacek-prisma commented Mar 25, 2026

Adds a statementNameGenerator pg setting for pasing a custom name generator to allow users to leverage pg statement caching

Tackles #28683

Summary by CodeRabbit

  • New Features
    • Added optional statementNameGenerator configuration option to the PostgreSQL adapter, enabling customization of how statement names are generated and assigned.
    • Introduced StatementNameGenerator type to standardize the callback signature used for generating custom statement name identifiers.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 25, 2026

Walkthrough

Added support for optional statement name generation in the PostgreSQL adapter by introducing a new statementNameGenerator option in PrismaPgOptions and a new StatementNameGenerator type to enable prepared-statement name generation for pg statement caching.

Changes

Cohort / File(s) Summary
Tests
packages/adapter-pg/src/__tests__/pg.test.ts
Added two Vitest cases validating statementNameGenerator integration into queryRaw calls, including cases with and without the generator, verifying correct invocation and parameter passing.
Type Definitions & Implementation
packages/adapter-pg/src/pg.ts
Introduced StatementNameGenerator type, extended PrismaPgOptions with optional statementNameGenerator property, and implemented statement name generation in performIO for prepared-statement execution.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a statement name generator feature for the pg adapter to enable statement caching.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pg-statement-name-generator

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
packages/client/runtime/index-browser.js 2.29 KB (0%)
packages/client/runtime/index-browser.d.ts 3.37 KB (0%)
packages/cli/build/index.js 2.48 MB (0%)
packages/client/prisma-client-0.0.0.tgz 26.81 MB (-0.01% 🔽)
packages/cli/prisma-0.0.0.tgz 13.51 MB (0%)
packages/bundle-size/da-workers-libsql/output.tgz 1.33 MB (0%)
packages/bundle-size/da-workers-neon/output.tgz 1.39 MB (0%)
packages/bundle-size/da-workers-pg/output.tgz 1.38 MB (+0.01% 🔺)
packages/bundle-size/da-workers-planetscale/output.tgz 1.33 MB (0%)
packages/bundle-size/da-workers-d1/output.tgz 1.3 MB (0%)

@aqrln aqrln added this to the 7.6.0 milestone Mar 25, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Mar 25, 2026
@jacek-prisma jacek-prisma merged commit f2ca67e into main Mar 25, 2026
498 of 499 checks passed
@jacek-prisma jacek-prisma deleted the feat/pg-statement-name-generator branch March 25, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants