feat: add configurable write_functions - #1236
Conversation
|
@levkk should new features like these be compatible with legacy parser path too ? |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
That's fine, we'll be removing the legacy parser shortly (tm). |
| /// Functions that should be treated as write-only. | ||
| /// Each entry can be schema-qualified. | ||
| #[serde(default)] | ||
| pub functions: Vec<String>, |
There was a problem hiding this comment.
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.
This PR introduces a helper method to normalize the identifiers of config files. This follows the same procedure as query parsing per the protocol. The consumption of the helper is done at `resolve_sharded_table` on `name`, `schema` and `column`. Tests have been added aswell 🧪 This PR closes #1238 and helps to reduce the complexity in the following PR: #1236
Description
Testing
Added unit and integration coverage for routing, schema qualification, and PG identifier semantics.
Related Issues
#623