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

Indicate that PostgreSQL 16.x has been tested and 11.x is deprecated #4788

Merged
merged 3 commits into from
Sep 28, 2023
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
13 changes: 4 additions & 9 deletions api/src/org/labkey/api/data/dialect/PostgreSql91Dialect.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,13 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
* User: arauch
* Date: Dec 28, 2004
* Time: 8:58:25 AM
*/

// Base dialect for PostgreSQL. PostgreSQL 9.1 is no longer supported, however, we keep this class versioned as "91" to
// Base dialect for PostgreSQL. PostgreSQL 9.1 is no longer supported, however, we keep the dialects versioned to
// track changes we've implemented for each version over time.
public abstract class PostgreSql91Dialect extends SqlDialect
{
public static final int TEMPTABLE_GENERATOR_MINSIZE = 1000;
public static final String PRODUCT_NAME = "PostgreSQL";
public static final String RECOMMENDED = PRODUCT_NAME + " 16.x is the recommended version.";

private final Map<String, Integer> _domainScaleMap = new ConcurrentHashMap<>();
private final AtomicBoolean _arraySortFunctionExists = new AtomicBoolean(false);
Expand Down Expand Up @@ -1889,8 +1885,7 @@ public void addAdminWarningMessages(Warnings warnings, boolean showAllWarnings)
if (null != _adminWarning)
warnings.add(_adminWarning);
else if (showAllWarnings) // PostgreSqlDialectFactory.getStandardWarningMessage() is not accessible from here, so hard-code a sample warning
warnings.add(HtmlString.of("LabKey Server has not been tested against this version. PostgreSQL 15.x is the recommended version."));

warnings.add(HtmlString.of("LabKey Server has not been tested against this version. " + RECOMMENDED));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/org/labkey/core/dialect/PostgreSql92Dialect.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ protected Set<String> getReservedWords()
@Override
public String getProductName()
{
return PostgreSqlDialectFactory.PRODUCT_NAME;
return PostgreSql91Dialect.PRODUCT_NAME;
}

@Override
Expand Down
16 changes: 5 additions & 11 deletions core/src/org/labkey/core/dialect/PostgreSqlDialectFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.labkey.api.data.dialect.AbstractDialectRetrievalTestCase;
import org.labkey.api.data.dialect.DatabaseNotSupportedException;
import org.labkey.api.data.dialect.JdbcHelperTest;
import org.labkey.api.data.dialect.PostgreSql91Dialect;
import org.labkey.api.data.dialect.PostgreSqlServerType;
import org.labkey.api.data.dialect.SqlDialect;
import org.labkey.api.data.dialect.SqlDialectFactory;
Expand All @@ -45,11 +46,6 @@
import java.util.Map;
import java.util.Set;

/*
* User: adam
* Date: Nov 26, 2010
* Time: 9:19:38 PM
*/
public class PostgreSqlDialectFactory implements SqlDialectFactory
{
private static final Logger _log = LogHelper.getLogger(PostgreSqlDialectFactory.class, "PostgreSQL version warnings");
Expand All @@ -66,8 +62,6 @@ public PostgreSqlDialectFactory()
return "org.postgresql.Driver".equals(driverClassName) ? new PostgreSql_11_Dialect() : null;
}

final static String PRODUCT_NAME = "PostgreSQL";
final static String RECOMMENDED = PRODUCT_NAME + " 15.x is the recommended version.";
final static String JDBC_PREFIX = "jdbc:postgresql:";

@Override
Expand All @@ -80,15 +74,15 @@ public PostgreSqlDialectFactory()

int betaIdx = databaseProductVersion.indexOf("beta");
if (-1 != betaIdx)
databaseProductVersion = StringUtils.left(databaseProductVersion, betaIdx);
databaseProductVersion = StringUtils.left(databaseProductVersion, betaIdx).trim();

int rcIdx = databaseProductVersion.indexOf("rc");
if (-1 != rcIdx)
databaseProductVersion = StringUtils.left(databaseProductVersion, rcIdx);
databaseProductVersion = StringUtils.left(databaseProductVersion, rcIdx).trim();

int parenIdx = databaseProductVersion.indexOf("(");
if (-1 != parenIdx)
databaseProductVersion = StringUtils.left(databaseProductVersion, parenIdx);
databaseProductVersion = StringUtils.left(databaseProductVersion, parenIdx).trim();

VersionNumber versionNumber = new VersionNumber(databaseProductVersion);
PostgreSqlVersion psv = PostgreSqlVersion.get(versionNumber.getVersionInt());
Expand Down Expand Up @@ -123,7 +117,7 @@ else if (psv.isDeprecated())

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

@Override
Expand Down
4 changes: 2 additions & 2 deletions core/src/org/labkey/core/dialect/PostgreSqlVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
public enum PostgreSqlVersion
{
POSTGRESQL_UNSUPPORTED(-1, true, false, null),
POSTGRESQL_11(110, false, true, PostgreSql_11_Dialect::new),
POSTGRESQL_11(110, true, true, PostgreSql_11_Dialect::new),
POSTGRESQL_12(120, false, true, PostgreSql_12_Dialect::new),
POSTGRESQL_13(130, false, 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, false, PostgreSql_16_Dialect::new),
POSTGRESQL_16(160, false, true, PostgreSql_16_Dialect::new),
POSTGRESQL_FUTURE(Integer.MAX_VALUE, true, false, PostgreSql_16_Dialect::new);

private final int _version;
Expand Down
Loading