Skip to content

feat: add configurable write_functions#1236

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

feat: add configurable write_functions#1236
murex971 wants to merge 6 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.
  • Added optional schema support so functions can be fully qualified per DB.
  • 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.75325% with 5 lines in your changes missing coverage. Please review.

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

📢 Thoughts on this report? Let us know!

pub database: String,
/// Functions that should be treated as write-only.
#[serde(default)]
pub functions: Vec<String>,

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.

Functions need to be fully qualifiable, e.g.: partman.create_partition is a write function, while create_partition(array) may not be.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added optional schema, not sure if you were referring to this ?

@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
# [[write_functions]]
# database = "pgdog"
# schema = "partman" # optional
# functions = ["my_write_fn", "\"Set_Customer_Balance\""]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@levkk I noticed a behavior gap around identifier normalization from pgdog.toml vs PostgreSQL semantics.

Right now, for write_functions, we normalize config identifiers with PG-like rules (unquoted -> lowercase, quoted -> case-preserving), but this is not consistently applied across other config-driven identifier matching paths in PgDog.

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