Package liquibase.database.core
Class PostgresDatabase
java.lang.Object
liquibase.database.AbstractJdbcDatabase
liquibase.database.core.AbstractPostgresDatabase
liquibase.database.core.PostgresDatabase
- All Implemented Interfaces:
AutoCloseable,Database,PrioritizedService
- Direct Known Subclasses:
CockroachDatabase,EnterpriseDBDatabase
Encapsulates PostgreSQL database support.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final StringThe data type names which are valid for auto-increment columns.Fields inherited from class liquibase.database.AbstractJdbcDatabase
caseSensitive, currentDateTimeFunction, dateFunctions, defaultAutoIncrementBy, defaultAutoIncrementStartWith, defaultCatalogName, defaultSchemaName, quotingStrategy, sequenceCurrentValueFunction, sequenceNextValueFunction, unmodifiableDataTypes, unquotedObjectsAreUppercasedFields inherited from interface liquibase.database.Database
COMPLETE_SQL_SCOPE_KEY, IGNORE_MISSING_REFERENCES_KEYFields inherited from interface liquibase.servicelocator.PrioritizedService
COMPARATOR, PRIORITY_DATABASE, PRIORITY_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleangenerateAutoIncrementBy(BigInteger incrementBy) booleangenerateAutoIncrementStartWith(BigInteger startWith) generatePrimaryKeyName(String tableName) Generates PK followingPostgreSQLconventions: Postgres PK size is limited with 63 bytes.protected StringgetAutoIncrementClause(String generationType, Boolean defaultOnNull) Default implementation.protected StringgetDefaultDriver(String url) If this database understands the given url, return the default driver class name.intMost relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.intReturns an all-lower-case short name of the product.inthashCode()booleanIs this AbstractDatabase subclass the correct one to use for the given connection.voidvoidrollback()voidsaveSearchPath(String searchPath) voidbooleanWhether check constraints on this database can be read by the standard check-constraint snapshot service.booleanWhether PostgreSQL-style composite types (CREATE TYPE ... AS (...)) on this database can be read by the standard composite-type snapshot generator.booleansupportsCreateIfNotExists(Class<? extends DatabaseObject> type) Does the database support the "if not exits" syntax?booleanDoes the particular database implementation support the database changelog history feature and associated table?booleanWhether PostgreSQL-style enumerated types (CREATE TYPE ... AS ENUM (...)) on this database can be read by the standard enum-type snapshot generator.booleanReturns whether this database support initially deferrable columns.booleanDoes the database type support sequence.booleanWhether stored database logic (functions, procedures, packages, triggers) can be snapshotted from this database via the standard stored-logic snapshot generators.booleanMethods inherited from class liquibase.database.core.AbstractPostgresDatabase
correctObjectName, escapeObjectName, getConnectionSchemaNameCallStatement, getDatabaseChangeLogLockTableName, getDatabaseChangeLogTableName, getSchemaAndCatalogCase, getSystemViews, hasMixedCase, isReservedWord, isSystemObject, setDefaultCatalogName, supportsCatalogInObjectName, unescapeDataTypeName, useSerialDatatypesMethods inherited from class liquibase.database.AbstractJdbcDatabase
addReservedWords, canCreateChangeLogTable, close, commit, correctSchema, correctSchema, createsIndexesForForeignKeys, dataTypeIsNotModifiable, disableForeignKeyChecks, doesTagExist, dropDatabaseObjects, enableForeignKeyChecks, escapeColumnName, escapeColumnName, escapeColumnNameList, escapeConstraintName, escapeDataTypeName, escapeIndexName, escapeObjectName, escapeSequenceName, escapeStringForDatabase, escapeTableName, escapeViewName, execute, executeRollbackStatements, executeRollbackStatements, executeStatements, filterRollbackVisitors, generateDatabaseFunctionValue, get, getAutoCommitMode, getAutoIncrementByClause, getAutoIncrementClause, getAutoIncrementClosing, getAutoIncrementOpening, getAutoIncrementStartWithClause, getConcatSql, getConnection, getConnectionCatalogName, getConnectionSchemaName, getContainingObjects, getCurrentDateTimeFunction, getDatabaseMajorVersion, getDatabaseMinorVersion, getDatabaseProductName, getDatabaseProductVersion, getDataTypeMaxParameters, getDateFunctions, getDateLiteral, getDateLiteral, getDateLiteral, getDateTimeLiteral, getDefaultCatalogName, getDefaultFractionalDigitsForTimestamp, getDefaultScaleForNativeDataType, getDefaultSchema, getDefaultSchemaName, getFetchSize, getJdbcCatalogName, getJdbcCatalogName, getJdbcSchemaName, getJdbcSchemaName, getLineComment, getLiquibaseCatalogName, getLiquibaseSchemaName, getLiquibaseTablespaceName, getName, getObjectQuotingStrategy, getOutputDefaultCatalog, getOutputDefaultSchema, getQuotingEndCharacter, getQuotingEndReplacement, getQuotingStartCharacter, getRanChangeSet, getRanChangeSetList, getRanDate, getRawDatabaseChangeLogLockTableName, getRawDatabaseChangeLogTableName, getRunStatus, getSchemaFromJdbcInfo, getSystemSchema, getSystemTables, getTimeLiteral, getViewDefinition, isAutoCommit, isCaseSensitive, isCatalogOrSchemaType, isCurrentTimeFunction, isDateOnly, isDateTime, isDefaultCatalog, isDefaultSchema, isFunction, isLiquibaseObject, isSafeToRunUpdate, isSystemView, isTimeOnly, isTimestamp, jdbcCallsCatalogsSchemas, markChangeSetExecStatus, mustQuoteObjectName, parseDate, quoteObject, removeRanStatus, requiresExplicitNullForColumns, requiresPassword, requiresUsername, resetInternalState, saveRollbackStatement, saveStatements, set, setAutoCommit, setCanCacheLiquibaseTableInfo, setCaseSensitive, setCurrentDateTimeFunction, setDatabaseChangeLogLockTableName, setDatabaseChangeLogTableName, setDefaultSchemaName, setLiquibaseCatalogName, setLiquibaseSchemaName, setLiquibaseTablespaceName, setObjectQuotingStrategy, setOutputDefaultCatalog, setOutputDefaultSchema, setPreviousAutoCommit, startsWithNumeric, supportsAutoIncrement, supportsBatchUpdates, supportsCatalogs, supportsDDLInTransaction, supportsDropTableCascadeConstraints, supportsForeignKeyDisable, supportsNotNullConstraintNames, supportsPrimaryKeyNames, supportsRestrictForeignKeys, supportsSchemas, tag, toString, unescapeDataTypeString, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface liquibase.database.Database
addCompleteSqlToScope, afterUpdate, checkDatabaseConnection, dropDatabaseObjects, escapeForLike, escapeTablespaceName, failOnDefferable, generateConnectCommandSuccessMessage, getDisplayName, supports, temporarilySetObjectQuotingStrategy
-
Field Details
-
PRODUCT_NAME
- See Also:
-
MINIMUM_DBMS_MAJOR_VERSION
public static final int MINIMUM_DBMS_MAJOR_VERSION- See Also:
-
MINIMUM_DBMS_MINOR_VERSION
public static final int MINIMUM_DBMS_MINOR_VERSION- See Also:
-
VALID_AUTO_INCREMENT_COLUMN_TYPE_NAMES
The data type names which are valid for auto-increment columns.
-
-
Constructor Details
-
PostgresDatabase
public PostgresDatabase()
-
-
Method Details
-
equals
- Overrides:
equalsin classAbstractJdbcDatabase
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractJdbcDatabase
-
getShortName
Description copied from interface:DatabaseReturns an all-lower-case short name of the product. Used for end-user selecting of database type such as the DBMS precondition. -
getDefaultDatabaseProductName
- Specified by:
getDefaultDatabaseProductNamein classAbstractJdbcDatabase
-
getDefaultPort
-
getPriority
public int getPriority() -
supportsInitiallyDeferrableColumns
public boolean supportsInitiallyDeferrableColumns()Description copied from interface:DatabaseReturns whether this database support initially deferrable columns. -
isCorrectDatabaseImplementation
Description copied from interface:DatabaseIs this AbstractDatabase subclass the correct one to use for the given connection.- Throws:
DatabaseException
-
getDefaultDriver
Description copied from interface:DatabaseIf this database understands the given url, return the default driver class name. Otherwise return null. -
supportsSequences
public boolean supportsSequences()Description copied from class:AbstractJdbcDatabaseDoes the database type support sequence.- Specified by:
supportsSequencesin interfaceDatabase- Overrides:
supportsSequencesin classAbstractJdbcDatabase
-
setConnection
- Specified by:
setConnectionin interfaceDatabase- Overrides:
setConnectionin classAbstractJdbcDatabase
-
supportsTablespaces
public boolean supportsTablespaces() -
getAutoIncrementClause
- Overrides:
getAutoIncrementClausein classAbstractJdbcDatabase
-
getAutoIncrementClause
Description copied from class:AbstractJdbcDatabaseDefault implementation. Intended for override in database specific cases- Overrides:
getAutoIncrementClausein classAbstractJdbcDatabase
-
generateAutoIncrementStartWith
- Overrides:
generateAutoIncrementStartWithin classAbstractJdbcDatabase
-
generateAutoIncrementBy
- Overrides:
generateAutoIncrementByin classAbstractJdbcDatabase
-
generatePrimaryKeyName
Generates PK followingPostgreSQLconventions:- Postgres PK size is limited with 63 bytes.
- Postgres PK is suffixed with '_pkey'.
- Specified by:
generatePrimaryKeyNamein interfaceDatabase- Overrides:
generatePrimaryKeyNamein classAbstractJdbcDatabase- Parameters:
tableName- Table name as the base name for the generated PK.- Returns:
- PK name.
-
getMaxFractionalDigitsForTimestamp
public int getMaxFractionalDigitsForTimestamp()Description copied from class:AbstractJdbcDatabaseMost relational databases support 9 fractional digits, and subclasses must overwrite this method if they support less than that.- Specified by:
getMaxFractionalDigitsForTimestampin interfaceDatabase- Overrides:
getMaxFractionalDigitsForTimestampin classAbstractJdbcDatabase- Returns:
- the maximum number of supported fractional digits in TIMESTAMP columns
-
rollback
- Specified by:
rollbackin interfaceDatabase- Overrides:
rollbackin classAbstractJdbcDatabase- Throws:
DatabaseException
-
saveSearchPath
-
restoreSearchPath
- Throws:
DatabaseException
-
supportsCreateIfNotExists
Description copied from interface:DatabaseDoes the database support the "if not exits" syntax?- Parameters:
type- the DatabaseObject type to be checked.- Returns:
- true if the "if not exists" syntax is supported, false otherwise.
-
supportsDatabaseChangeLogHistory
public boolean supportsDatabaseChangeLogHistory()Description copied from interface:DatabaseDoes the particular database implementation support the database changelog history feature and associated table?- Returns:
- true if supported, false otherwise
-
supportsEnumTypeSnapshot
public boolean supportsEnumTypeSnapshot()Description copied from class:AbstractPostgresDatabaseWhether PostgreSQL-style enumerated types (CREATE TYPE ... AS ENUM (...)) on this database can be read by the standard enum-type snapshot generator. Named for snapshot-ability, not raw SQL capability.- Overrides:
supportsEnumTypeSnapshotin classAbstractPostgresDatabase- Returns:
- true if enum types on this database are snapshot-able via the standard generator
-
supportsCompositeTypeSnapshot
public boolean supportsCompositeTypeSnapshot()Description copied from class:AbstractPostgresDatabaseWhether PostgreSQL-style composite types (CREATE TYPE ... AS (...)) on this database can be read by the standard composite-type snapshot generator. Named for snapshot-ability, not raw SQL capability: a variant may accept the DDL yet returnfalsehere because the standard generator cannot read its catalog.- Overrides:
supportsCompositeTypeSnapshotin classAbstractPostgresDatabase- Returns:
- true if composite types on this database are snapshot-able via the standard generator
-
supportsCheckConstraintSnapshot
public boolean supportsCheckConstraintSnapshot()Description copied from class:AbstractPostgresDatabaseWhether check constraints on this database can be read by the standard check-constraint snapshot service. Named for snapshot-ability, not enforcement: e.g. Redshift acceptsCHECKin DDL but never enforces it and exposes no usable catalog for it, so it returnsfalse. (Cross-family concept; non-Postgres families still gate viainstanceofinStandardCheckConstraintServiceuntil the 6.1+ sweep.)- Overrides:
supportsCheckConstraintSnapshotin classAbstractPostgresDatabase- Returns:
- true if check constraints on this database are snapshot-able via the standard service
-
supportsStoredLogicSnapshot
public boolean supportsStoredLogicSnapshot()Description copied from class:AbstractPostgresDatabaseWhether stored database logic (functions, procedures, packages, triggers) can be snapshotted from this database via the standard stored-logic snapshot generators. (Cross-family concept; non-Postgres families still gate viainstanceofuntil the 6.1+ sweep.)- Overrides:
supportsStoredLogicSnapshotin classAbstractPostgresDatabase- Returns:
- true if stored logic on this database is snapshot-able via the standard generators
-