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

Added Postgres to the list of database which do not need arguments with SMALLINT DAT-4370 #1046

Merged
merged 3 commits into from Apr 3, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -34,8 +34,10 @@ public DatabaseDataType toDatabaseDataType(Database database) {
type.addAdditionalInformation(getAdditionalInformation());
return type;
}
if ((database instanceof AbstractDb2Database) || (database instanceof DerbyDatabase) || (database instanceof
FirebirdDatabase) || (database instanceof InformixDatabase)) {
if ((database instanceof AbstractDb2Database) ||
(database instanceof DerbyDatabase) ||
(database instanceof FirebirdDatabase) ||
(database instanceof InformixDatabase)) {
return new DatabaseDataType("SMALLINT"); //always smallint regardless of parameters passed
}

Expand All @@ -45,16 +47,17 @@ public DatabaseDataType toDatabaseDataType(Database database) {

if (database instanceof PostgresDatabase)
{
if (isAutoIncrement()) {
int majorVersion = 9;
try {
majorVersion = database.getDatabaseMajorVersion();
} catch (DatabaseException e) {
// ignore
}
if (majorVersion < 10) {
return new DatabaseDataType("SMALLSERIAL");
}
if (! isAutoIncrement()) {
return new DatabaseDataType("SMALLINT"); //always smallint regardless of parameters passed
}
int majorVersion = 9;
try {
majorVersion = database.getDatabaseMajorVersion();
} catch (DatabaseException e) {
// ignore
}
if (majorVersion < 10) {
return new DatabaseDataType("SMALLSERIAL");
}
}

Expand Down