Skip to content

Conversation

@joshpencheon
Copy link
Contributor

Issue Summary

Currently, when dumping column comments, user_tab_columns is used. This misses comments which are in the current schema, when the current user is not the owner.

PR Summary

This PR dumps column comments from all_tab_cols instead, filtering owner to the current_schema. This is in line with the approach taken for the rest of the objects extracting during the structure dump.

@joshpencheon
Copy link
Contributor Author

(The jruby builds appear to be failing for what seems to be unrelated reasons.)

columns = select_values(<<~SQL.squish, "SCHEMA")
SELECT /*+ OPTIMIZER_FEATURES_ENABLE('11.2.0.2') */ column_name FROM user_tab_columns
WHERE table_name = '#{table_name}' ORDER BY column_id
SELECT /*+ OPTIMIZER_FEATURES_ENABLE('11.2.0.2') */ column_name FROM all_tab_cols
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you explain why all_tab_cols is used not all_tab_columns?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's my ignorance, sorry! Having read some docs I will swap this out :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've force-pushed with this swapped out, thanks for the feedback. 👍

...and filter by owner, rather than using user_tab_columns. Ensures column
comments are dumped for the current schema
@joshpencheon joshpencheon force-pushed the fix-dumping-column-comments-across-schemas branch from 8308f41 to 7156d3d Compare January 14, 2021 09:36
@yahonda yahonda merged commit 6bdf82d into rsim:master Jan 14, 2021
@yahonda
Copy link
Collaborator

yahonda commented Jan 14, 2021

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants