Skip to content

feat: add configurable write_functions - #1236

Open
murex971 wants to merge 9 commits into
pgdogdev:mainfrom
murex971:murex-write-fn
Open

feat: add configurable write_functions#1236
murex971 wants to merge 9 commits into
pgdogdev:mainfrom
murex971:murex-write-fn

Conversation

@murex971

@murex971 murex971 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description

  • Implemented configurable write_functions routing in the new parser path.
  • For configured entries, matching ollows PostgreSQL identifier behavior (unquoted -> lowercase, quoted -> case-sensitive).
  • Kept existing hardcoded write functions.

Testing

Added unit and integration coverage for routing, schema qualification, and PG identifier semantics.

Related Issues

#623

@murex971

Copy link
Copy Markdown
Contributor Author

@levkk should new features like these be compatible with legacy parser path too ?
currently added to new parser path only.

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.51163% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pgdog/src/backend/pool/cluster.rs 91.66% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

Comment thread pgdog-config/src/sharding.rs
@levkk

levkk commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

@levkk should new features like these be compatible with legacy parser path too ? currently added to new parser path only.

That's fine, we'll be removing the legacy parser shortly (tm).

Comment thread example.pgdog.toml Outdated
Comment thread pgdog-config/src/sharding.rs Outdated
@murex971
murex971 requested a review from levkk July 22, 2026 17:05
/// Functions that should be treated as write-only.
/// Each entry can be schema-qualified.
#[serde(default)]
pub functions: Vec<String>,

@levkk levkk Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want something like this:

[[write_functions]]
database = "prod"
name = "create_partition"
schema = "partman"

This allows you to disambiguiate between the same function created in different schemas. It's not a common edge case, but it can happen, and we want to be able to scope all Postgres primitives we scan for using a fully qualified identifier. I know that functions can be overloaded, so we should consider capturing parameter data types as well, but for read/write separation it seems unlikely that one version of the function reads and the other one writes, so maybe that's not necessary for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants