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

fix: prevent dropping materialized views on Postgres versions < 9.3 #7716

Merged
merged 2 commits into from Jul 24, 2021

Conversation

AlexMesser
Copy link
Collaborator

@AlexMesser AlexMesser commented Jun 7, 2021

Description of change

Materialized views introduced in Postgres 9.3. This PR adds version check before dropping materialized views to prevent errors on Postgres versions lower than 9.3

Fixes #7714

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

Copy link
Contributor

@imnotjames imnotjames left a comment

Choose a reason for hiding this comment

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

We can probably cache the version but this works anyway.

@imnotjames
Copy link
Contributor

However, I agree with the comment in the related issue:

Postgres 9.2 official support was ended in 2017. We can't keep backward compatibility for all existing database versions.

It'd be easier to update the documentation to just say we require Postgres >= 9.3

@imnotjames imnotjames mentioned this pull request Jun 18, 2021
7 tasks
/**
* Loads Postgres version.
*/
protected async getVersion(): Promise<string> {
Copy link
Contributor

@mitsos1os mitsos1os Jun 18, 2021

Choose a reason for hiding this comment

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

Wouldn't it be better if getVersion moved to PostgresDriver, also cache the result as a property in the driver (ex: serverVersion) that could later be used directly in any subsequent scenarios? (ex: #7741)

@AlexMesser AlexMesser merged commit 29f1f86 into master Jul 24, 2021
@AlexMesser AlexMesser deleted the 7714 branch July 24, 2021 09:35
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.

PostgreSQL - QueryFailedError: relation "pg_matviews" does not exist
4 participants