Обсуждение: [pgjdbc/pgjdbc] 0999bb: Fix TestUtil.dropXyz(...) object not existserrors...
[pgjdbc/pgjdbc] 0999bb: Fix TestUtil.dropXyz(...) object not existserrors...
От
Sehrope Sarkuni
Дата:
Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: 0999bb78ecb0a305f830d8b76ae24f6e64444ec8 https://github.com/pgjdbc/pgjdbc/commit/0999bb78ecb0a305f830d8b76ae24f6e64444ec8 Author: Sehrope Sarkuni <sehrope@jackdb.com> Date: 2018-12-05 (Wed, 05 Dec 2018) Changed paths: M pgjdbc/src/test/java/org/postgresql/test/TestUtil.java M pgjdbc/src/test/java/org/postgresql/test/jdbc2/DatabaseMetaDataTest.java Log Message: ----------- Fix TestUtil.dropXyz(...) object not exists errors (#1359) * test: Change drop object utilities in TestUtils to use IF EXISTS Changes most drop object helper methods in TestUtils to check if a transaction is in progress and, if not, then use IF EXISTS to suppress errors for missing objects during the DROP command. If a transaction is in progress then the command then the drop is executed without the IF EXISTS clause so that missing objects results in an exception and test failure. In either case an unrelated error such as the server being offline will be now throw an exception. This is a change from the prior behavior where all errors that are not part of a transaction were being suppressed. errors if the object being dropped does not exist. * test: Change TestUtil.dropSequence(...) to add CASCADE Adds CASCADE option to TestUtils.dropSequence(...) helper to handle dependency errors in drop statements that previously being ignored. * test: Add shouldDrop param to TestUtils.createCompositeType(...) Also adds a method matching the previous signature without the new parameter and defaulting to the older behaviour of true (i.e. drop then create). * test: Use explicit drop type statements for metadata tests Adds explicit drop statements for types in metadata tests to ensure the drop statements are executed in the correct order. Also adds a drop statement for the reference table. The revised drop order is required as TestUtils no longer skips over non-missing object errors when dropping objects. * test: Clean up throws clauses in TestUtil Restricts throws clauses in TestUtil to SQLException rather than a more broad Exception and removes throws clause from initDriver(). **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019.