Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow get_tables to see views and v10-style partitioned tables #2549

Merged
merged 3 commits into from
Jun 6, 2018

Conversation

coreyhuinker
Copy link
Contributor

And it does so with just one query.

Copy link
Member

@arikfr arikfr left a comment

Choose a reason for hiding this comment

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

Is this backward compatible?

@coreyhuinker
Copy link
Contributor Author

tl;dr - yes

The catalog tables (pg_class, pg_attribute, pg_namespace) are present in all supported version of postgresql (and have probably been there since postgres started).

There have been no instances of postgres changing a relkind value from version to version, and it would be a major upgrade headache if they did try doing that.

While partitions don't exist prior to v10, there's no harm in running a query that would not filter out the nonexistent rows.

We may have to tweak the IN clause when new discoverable object types are made available in future version of postgres, but that's about it.

That, and the existing code risked duplicate entries for mviews if a future version of information_schema decided that mviews were tables.

This query should also work for the postgresql forks (Vertica, Redshift) though they may have chosen different relkind values for the object types.

@arikfr arikfr merged commit 672c86e into getredash:master Jun 6, 2018
@arikfr
Copy link
Member

arikfr commented Jun 6, 2018

Thank you for the pull request and the detailed explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants