Skip to content

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

Merged
arikfr merged 3 commits into
getredash:masterfrom
coreyhuinker:patch-1
Jun 6, 2018
Merged

Allow get_tables to see views and v10-style partitioned tables#2549
arikfr merged 3 commits into
getredash:masterfrom
coreyhuinker:patch-1

Conversation

@coreyhuinker

Copy link
Copy Markdown
Contributor

And it does so with just one query.

@arikfr arikfr left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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

arikfr commented Jun 6, 2018

Copy link
Copy Markdown
Member

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