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
Support PostgreSQL materialized views #13128
Conversation
Expand the query used in #table_exists? to include materialized views in the kinds of relations it searches.
I've had a look at the Travis logs, but there isn't much to go off. Is there a way to find out info about whichever error was raised? |
@@ -1,11 +1,26 @@ | |||
require "cases/helper" | |||
|
|||
module ViewTestConcern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to reopen the same module in the same file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did that purely for top-down readability. If I define ViewTestConcern
entirely up front, that pushes the two test class definitions to the bottom of the file. I thought it would be preferable to put them at the top. So no technical reason, it can be changed.
Same behaviour is provided by Utils.extract_schema_and_table, which also has tests.
Note that in dd3aba0 I did a bit of clean-up by removing |
😎 Apologies if it's bad form to bump a PR, I'm just unsure that this won't get lost in the crowd. |
@kastiglione Will work on this once 4.1 is out. I assigned the 4.2 milestone. |
✨ thanks @senny |
@kastiglione The refactorings might have a different impact. For example it favors the slower |
Sure, sounds good. Was trying to clean up what I saw as obvious duplication, but indeed they are separate changes. |
@kastiglione ping, wanted to check back if you have time to work on this? Please let me know if you don't so I can move this forward. Thank you for your work 💛 |
I don't have much time, but also work impediments besides time. Can I simply revert the last two commits, the ones that mucked with schema extraction? The first three commits were the ones core to supporting materialized views. Thanks to you as well. |
yes, you can. Make sure to squash the other commits into a single one and rebase your branch. It does no longer apply. |
I squashed the commits and applied the patch via cherry-pick (def6071) @kastiglione thank you for your work! |
Thanks @senny. My apologies for any delay I might have caused. |
@kastiglione no worries, we have plenty of time until |
The change is pretty minimal, the query used in
#table_exists?
has been expanded to include materialized views in the kinds of relations it includes in its search.In order to share the existing view tests, I made the previous test class into a concern that is then included into separate
ViewTest
andMaterializedViewTest
classes, the latter only if PostgreSQL is at least version 9.3.The test class then uses the name of the test to determine the type of view to create and test against.