Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
import liquibase.configuration.LiquibaseConfiguration;
import liquibase.database.Database;
import liquibase.database.DatabaseList;
import liquibase.database.core.AbstractDb2Database;
import liquibase.database.core.HsqlDatabase;
import liquibase.database.core.MSSQLDatabase;
import liquibase.database.core.OracleDatabase;
import liquibase.database.core.*;
import liquibase.exception.UnexpectedLiquibaseException;
import liquibase.exception.ValidationErrors;
import liquibase.parser.core.ParsedNode;
Expand Down Expand Up @@ -172,7 +169,7 @@ public ValidationErrors validate(Database database) {
}

if (this.getReplaceIfExists() != null && (DatabaseList.definitionMatches(getDbms(), database, true))) {
if (database instanceof MSSQLDatabase) {
if (database instanceof MSSQLDatabase || database instanceof PostgresDatabase) {
if (this.getReplaceIfExists() && this.getProcedureName() == null) {
validate.addError("procedureName is required if replaceIfExists = true");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
*/
public class PostgresDatabase extends AbstractJdbcDatabase {
public static final String PRODUCT_NAME = "PostgreSQL";
public static final String EDB_PRODUCT_NAME = "EnterpriseDB";

private Set<String> systemTablesAndViews = new HashSet<String>();

Expand Down Expand Up @@ -88,14 +89,22 @@ public boolean supportsInitiallyDeferrableColumns() {

@Override
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {
return PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName());
boolean matches = PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName());
if (matches) {
return true;
}
matches = EDB_PRODUCT_NAME.equals(conn.getDatabaseProductName());
return matches;
}

@Override
public String getDefaultDriver(String url) {
if (url.startsWith("jdbc:postgresql:")) {
return "org.postgresql.Driver";
}
else if (url.startsWith("jdbc:edb")) {
return "com.edb.Driver";
}
return null;
}

Expand Down