postgresql_publication: add row filter support#813
Merged
hunleyd merged 1 commit intoansible-collections:mainfrom Mar 12, 2025
Merged
postgresql_publication: add row filter support#813hunleyd merged 1 commit intoansible-collections:mainfrom
hunleyd merged 1 commit intoansible-collections:mainfrom
Conversation
3f76ea6 to
c317ef7
Compare
Collaborator
There was a problem hiding this comment.
@gspanos thanks for the PR!
Could you please:
- Add a changelog fragment, use
minor_changes: - Add test tasks with
check_mode: trueto the tests. Also check with pg_query that nothing has actually changed - Fix the red tests. If you click details and go to AZP, you'll see what the problems are
- Also you declare the parameters as mutually exclusive, please declare it in
module = AnsibleModule(, there's a similar case already there - Also an important question is if you feel committed to fix related bugs if they appear?
c317ef7 to
92b8bb2
Compare
92b8bb2 to
9c24fe7
Compare
Andersson007
approved these changes
Mar 12, 2025
Collaborator
Andersson007
left a comment
There was a problem hiding this comment.
@gspanos thanks!
Could other maintainers please take a look?
hunleyd
approved these changes
Mar 12, 2025
Collaborator
|
LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Add row filter support to
postgresql_publicationmodule, via an extra yaml parameter namedrowfiltersThis feature is supported since PG Version 15 (search "WHERE" or "row filter"):
Some design decisions:
WHEREclause. Internally, if the clause exists we remove it and then add it before constructing the SQL fragment. This simplifies, among other things, the row filter comparison described below.WHERE ("id" > 10 ), the double quote(") character won't be retained in thepg_publication_tables.rowfiltercolumn. So, short of writing an PG SQL parser, this was the best I could think of.I have included integration tests for both creation and updating of a publication, and also for testing the "idempotency" handling described above.
ISSUE TYPE
COMPONENT NAME
postgresql_publication
ADDITIONAL INFORMATION
This will allow a user to declare a row filter, in conjuction with either
tablesorcolumnsparameters like so:or in combination with
tablesparameter