class CockroachDatabase extends PostgresDatabase {

    private Integer databaseMajorVersion;
    private Integer databaseMinorVersion;

    private static final String VERSION_NUMBER_REGEX = "v(\\d+)\\.(\\d+)\\.(\\d+)";
    private static final Pattern VERSION_NUMBER_PATTERN = Pattern.compile(VERSION_NUMBER_REGEX);

    public CockroachDatabase() {
        super.setCurrentDateTimeFunction("NOW()");
    }

    @Override
    public int getPriority() {
        return super.getPriority() + 5;
    }

    @Override
    public String getShortName() {
        return "cockroachdb";
    }

    @Override
    protected String getDefaultDatabaseProductName() {
        return "CockroachDB";
    }

    @Override
    public int getDatabaseMajorVersion() throws DatabaseException {
        if (this.databaseMajorVersion == null) {
            return 20;
        }
        return this.databaseMajorVersion;
    }

    @Override
    public int getDatabaseMinorVersion() throws DatabaseException {
        if (this.databaseMinorVersion == null) {
            return 0;
        }
        return this.databaseMinorVersion;
    }

    @Override
    public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException {<FILL_FUNCTION_BODY>}

    @Override
    public Integer getDefaultPort() {
        return 26257;
    }

    @Override
    public boolean supportsInitiallyDeferrableColumns() {
        return false;
    }

    @Override
    public boolean supportsTablespaces() {
        return false;
    }

    @Override
    public boolean supportsDDLInTransaction() {
        return false;
    }

    @Override
    public void setConnection(DatabaseConnection conn) {
        super.setConnection(conn);
        this.databaseMajorVersion = null;
        this.databaseMinorVersion = null;

        if (conn instanceof JdbcConnection) {
            try {
                String version = Scope.getCurrentScope().getSingleton(ExecutorService.class).
                        getExecutor("jdbc", this).queryForObject(new RawSqlStatement("SELECT version()"), String.class);

                final Matcher versionMatcher = VERSION_NUMBER_PATTERN.matcher(version);
                if (versionMatcher.find()) {
                    this.databaseMajorVersion = Integer.parseInt(versionMatcher.group(1));
                    this.databaseMinorVersion = Integer.parseInt(versionMatcher.group(2));
                }
            } catch (Throwable e) {
                Scope.getCurrentScope().getLog(getClass()).fine("Cannot determine cockroachdb version: " + e.getMessage(), e);
            }
        } else {
            Scope.getCurrentScope().getLog(getClass()).fine("Cannot determine cockroachdb version: cannot query database");
        }
    }

    @Override
    public boolean useSerialDatatypes() {
        try {
            return !(getDatabaseMajorVersion() > 21 || (getDatabaseMajorVersion() == 21 && getDatabaseMinorVersion() >= 2));
        } catch (DatabaseException e) {
            return true;
        }
    }

    @Override
    public boolean supportsCreateIfNotExists(Class<? extends DatabaseObject> type) {
        return type.isAssignableFrom(Table.class);
    }
}

        final String url = conn.getURL();
        if (url.startsWith("jdbc:postgres") || url.startsWith("postgres")) {
            if (conn instanceof JdbcConnection) {
                try (Statement stmt = ((JdbcConnection) conn).createStatement()) {
                    if (stmt != null) {
                        try (ResultSet rs = stmt.executeQuery("select version()")) {
                            if (rs.next()) {
                                return ((String) JdbcUtil.getResultSetValue(rs, 1)).startsWith("CockroachDB");
                            }
                        }
                    }
                } catch (SQLException throwables) {
                    return false;
                }
            }
        }

        return false;
    
<methods>public void <init>() ,public java.lang.String correctObjectName(java.lang.String, Class<? extends liquibase.structure.DatabaseObject>) ,public boolean equals(java.lang.Object) ,public java.lang.String escapeObjectName(java.lang.String, Class<? extends liquibase.structure.DatabaseObject>) ,public boolean generateAutoIncrementBy(java.math.BigInteger) ,public boolean generateAutoIncrementStartWith(java.math.BigInteger) ,public java.lang.String generatePrimaryKeyName(java.lang.String) ,public java.lang.String getAutoIncrementClause() ,public java.lang.String getDatabaseChangeLogLockTableName() ,public java.lang.String getDatabaseChangeLogTableName() ,public java.lang.String getDefaultDriver(java.lang.String) ,public java.lang.Integer getDefaultPort() ,public int getMaxFractionalDigitsForTimestamp() ,public int getPriority() ,public liquibase.CatalogAndSchema.CatalogAndSchemaCase getSchemaAndCatalogCase() ,public java.lang.String getShortName() ,public Set<java.lang.String> getSystemViews() ,public int hashCode() ,public boolean isCorrectDatabaseImplementation(liquibase.database.DatabaseConnection) throws liquibase.exception.DatabaseException,public boolean isReservedWord(java.lang.String) ,public boolean isSystemObject(liquibase.structure.DatabaseObject) ,public void rollback() throws liquibase.exception.DatabaseException,public void setConnection(liquibase.database.DatabaseConnection) ,public void setDefaultCatalogName(java.lang.String) ,public boolean supportsCatalogInObjectName(Class<? extends liquibase.structure.DatabaseObject>) ,public boolean supportsCreateIfNotExists(Class<? extends liquibase.structure.DatabaseObject>) ,public boolean supportsDatabaseChangeLogHistory() ,public boolean supportsInitiallyDeferrableColumns() ,public boolean supportsSequences() ,public boolean supportsTablespaces() ,public java.lang.String unescapeDataTypeName(java.lang.String) ,public boolean useSerialDatatypes() <variables>private static final liquibase.logging.Logger LOG,public static final int MINIMUM_DBMS_MAJOR_VERSION,public static final int MINIMUM_DBMS_MINOR_VERSION,private static final int PGSQL_DEFAULT_TCP_PORT_NUMBER,static final int PGSQL_PK_BYTES_LIMIT,static final java.lang.String PGSQL_PK_SUFFIX,public static final java.lang.String PRODUCT_NAME,public static final List<java.lang.String> VALID_AUTO_INCREMENT_COLUMN_TYPE_NAMES,private static final java.lang.String dbFullVersion,private final Set<java.lang.String> reservedWords,private final Set<java.lang.String> systemTablesAndViews