Support PostgreSQL 10+ partitioning #26
Merged
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.
Include partitioned tables, but ignore their partitions. Without this change, it would fail on database schemas involving partitioning.
Note the use of the
row_to_json()
function is to permit backward compatibility with PostgreSQL 9 and 10. Therelispartition
column does not exist until PostgreSQL 10 and theconparentid
column does not exist until PostgreSQL 11. Directly referencing these columns, while simpler, would cause the query to fail in those earlier versions. While another approach would be to generate different SQL for different PostgreSQL versions, that seems like it would be more work. Note however that this use of JSON means it will no longer work on PostgreSQL 9.2 and earlier, since the necessary JSON support was introduced in 9.3. That's hopefully not a big issue, given 9.2 reached its end-of-support date almost 5 years ago.