Skip to content
Merged
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
1 change: 0 additions & 1 deletion core/src/org/labkey/core/dialect/PostgreSql92Dialect.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
abstract class PostgreSql92Dialect extends BasePostgreSqlDialect
{
public static final String PRODUCT_NAME = "PostgreSQL";
public static final String RECOMMENDED = PRODUCT_NAME + " 17.x is the recommended version.";

// This has been the standard PostgreSQL identifier max byte length for many years. However, this could change in
// the future plus servers can be compiled with a different limit, so we query this setting on first connection to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.labkey.core.dialect;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -65,7 +66,7 @@ public PostgreSqlDialectFactory()
@Override
public @Nullable SqlDialect createFromMetadata(DatabaseMetaData md, boolean logWarnings, boolean primaryDataSource) throws SQLException, DatabaseNotSupportedException
{
if (!(StringUtils.startsWithIgnoreCase(md.getURL(), JDBC_PREFIX)))
if (!(Strings.CI.startsWith(md.getURL(), JDBC_PREFIX)))
return null;

String databaseProductVersion = md.getDatabaseProductVersion();
Expand Down Expand Up @@ -115,7 +116,7 @@ else if (psv.isDeprecated())

public static String getStandardWarningMessage(String warning, String databaseProductVersion)
{
return "LabKey Server " + warning + " " + PostgreSql92Dialect.PRODUCT_NAME + " version " + databaseProductVersion + ". " + PostgreSql92Dialect.RECOMMENDED;
return "LabKey Server " + warning + " " + PostgreSql92Dialect.PRODUCT_NAME + " version " + databaseProductVersion + ". " + PostgreSqlVersion.RECOMMENDED;
}

@Override
Expand Down
8 changes: 6 additions & 2 deletions core/src/org/labkey/core/dialect/PostgreSqlVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;

import static org.labkey.core.dialect.PostgreSql92Dialect.PRODUCT_NAME;

/**
* Enum that specifies the versions of PostgreSQL that LabKey supports plus their properties
*/
public enum PostgreSqlVersion
{
POSTGRESQL_UNSUPPORTED(-1, true, false, null),
POSTGRESQL_13(130, false, true, PostgreSql_13_Dialect::new),
POSTGRESQL_13(130, true, true, PostgreSql_13_Dialect::new),
POSTGRESQL_14(140, false, true, PostgreSql_14_Dialect::new),
POSTGRESQL_15(150, false, true, PostgreSql_15_Dialect::new),
POSTGRESQL_16(160, false, true, PostgreSql_16_Dialect::new),
POSTGRESQL_17(170, false, true, PostgreSql_17_Dialect::new),
POSTGRESQL_18(180, false, false, PostgreSql_18_Dialect::new),
POSTGRESQL_18(180, false, true, PostgreSql_18_Dialect::new),
POSTGRESQL_FUTURE(Integer.MAX_VALUE, true, false, PostgreSql_18_Dialect::new);

public static final String RECOMMENDED = PRODUCT_NAME + " 18.x is the recommended version.";

private final int _version;
private final boolean _deprecated;
private final boolean _tested;
Expand Down