postgresql_table: Fix multiple schema handling (#817)#818
Merged
hunleyd merged 1 commit intoansible-collections:mainfrom Apr 2, 2025
Merged
postgresql_table: Fix multiple schema handling (#817)#818hunleyd merged 1 commit intoansible-collections:mainfrom
hunleyd merged 1 commit intoansible-collections:mainfrom
Conversation
Collaborator
|
This looks good @rlaager but would you mind adding a changelog fragment and possibly a test? |
Collaborator
|
@rlaager hi, here's the changelog guide link |
370383e to
4de5c62
Compare
Contributor
Author
|
Changelog fragment added. It and the commit message parallel 09fec84, which was the same issue with the postgresql_idx module. |
hunleyd
requested changes
Apr 1, 2025
…ions#817) When checking to see if an table exists, the schema name needs to be taken into account. That is, the same name can exist in multiple schemas. Fixes ansible-collections#817
54cff26 to
007b528
Compare
Andersson007
approved these changes
Apr 2, 2025
hunleyd
approved these changes
Apr 2, 2025
Collaborator
|
thanks @rlaager ! |
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
The
postgresql_tablecommand shows spurious change status (and attempts unnecessaryALTER TABLE...OWNER TO) when multiple schemas have tables of the same name (which is the table being operated on by the task).This happens because the query to get the existing information does not properly limit by schema name for the
pg_tablesview. It only limits for thepg_namespacepart of the query. As a result, this query returns multiple rows, one per schema containing a table of the specified name.Fixes #817
ISSUE TYPE
COMPONENT NAME
postgresql_table
ADDITIONAL INFORMATION
BEFORE:
AFTER: