-
Notifications
You must be signed in to change notification settings - Fork 160
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
issue 2751 make sure drop schema drops everything #2932
Conversation
Signed-off-by: Robin Arnold <robin.arnold@ibm.com>
Signed-off-by: Robin Arnold <robin.arnold@ibm.com>
Signed-off-by: Robin Arnold <robin.arnold@ibm.com>
...atabase-utils/src/main/java/com/ibm/fhir/database/utils/postgres/PostgresDoesIndexExist.java
Outdated
Show resolved
Hide resolved
fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/common/ListTablesDAO.java
Outdated
Show resolved
Hide resolved
fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/common/SchemaInfoObject.java
Outdated
Show resolved
Hide resolved
fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/common/SchemaInfoObject.java
Show resolved
Hide resolved
...-database-utils/src/main/java/com/ibm/fhir/database/utils/db2/Db2ListSequencesForSchema.java
Show resolved
Hide resolved
fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/db2/Db2ListTablesForSchema.java
Show resolved
Hide resolved
fhir-database-utils/src/main/java/com/ibm/fhir/database/utils/derby/DerbyAdapter.java
Outdated
Show resolved
Hide resolved
...abase-utils/src/main/java/com/ibm/fhir/database/utils/derby/DerbyListSequencesForSchema.java
Show resolved
Hide resolved
+ " WHERE LOWER(table_schema) = LOWER('" + schemaName + "') " | ||
+ " AND LOWER(table_name) = LOWER('" + tableName + "')"; | ||
+ " WHERE table_schema = LOWER('" + schemaName + "') " | ||
+ " AND table_name = LOWER('" + tableName + "')"; |
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 think initially our Postgres code allowed upper case input. I know Postgres smacks it to LOWER internally.
Is this truly backwards compatible with our older versions?
Please confirm
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.
PostgreSQL lower-cases identifiers (like table-names) unless they are quoted (which we don't...because it makes things ugly and unreadable). Also, putting LOWER on the columns in that way prevents use of any indexes which could lead to much worse performance for bigger schemas.
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.
LGTM - left comments
Signed-off-by: Robin Arnold <robin.arnold@ibm.com>
but really just to force a rebuild... Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Signed-off-by: Robin Arnold robin.arnold@ibm.com
In addition to making sure we clean up the new WHOLE_SYSTEM_VERSION and CONTROL tables, we also now do a final check on the cleaned schema to make sure it is really clean and contains no tables.
The drop is now idempotent (dropping a second time will be a NOP) and if the drop is successful, the VERSION_HISTORY data will be cleared for the dropped schema, allowing the same schema name to be reused immediately.