Class PostgreSQLLegacyDialect

java.lang.Object
org.hibernate.dialect.Dialect
org.hibernate.community.dialect.PostgreSQLLegacyDialect
All Implemented Interfaces:
org.hibernate.boot.model.FunctionContributor, org.hibernate.boot.model.TypeContributor, org.hibernate.exception.spi.ConversionContext
Direct Known Subclasses:
PostgresPlusLegacyDialect

public class PostgreSQLLegacyDialect extends org.hibernate.dialect.Dialect
A SQL dialect for PostgreSQL 8 and above.
  • Nested Class Summary

    Nested classes/interfaces declared in class org.hibernate.dialect.Dialect

    org.hibernate.dialect.Dialect.SizeStrategy, org.hibernate.dialect.Dialect.SizeStrategyImpl
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.hibernate.dialect.PostgreSQLDriverKind
     

    Fields declared in class org.hibernate.dialect.Dialect

    CLOSED_QUOTE, FALSE_STRING_VALUES, LEGACY_LOB_MERGE_STRATEGY, LOG_BASE2OF10, NEW_LOCATOR_LOB_MERGE_STRATEGY, QUOTE, STANDARD_MULTI_KEY_LOAD_SIZING_STRATEGY, STREAM_XFER_LOB_MERGE_STRATEGY, TRUE_STRING_VALUES
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    PostgreSQLLegacyDialect(org.hibernate.dialect.DatabaseVersion version)
     
    PostgreSQLLegacyDialect(org.hibernate.dialect.DatabaseVersion version, org.hibernate.dialect.PostgreSQLDriverKind driverKind)
     
    PostgreSQLLegacyDialect(org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo info)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.hibernate.engine.jdbc.env.spi.IdentifierHelper
    buildIdentifierHelper(org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder builder, DatabaseMetaData metadata)
     
    boolean
     
    protected void
    contributePostgreSQLTypes(org.hibernate.boot.model.TypeContributions typeContributions, org.hibernate.service.ServiceRegistry serviceRegistry)
     
    org.hibernate.dialect.Replacer
     
    protected void
    extractField(StringBuilder pattern, org.hibernate.query.common.TemporalUnit unit, TemporalType fromTimestamp, TemporalType toTimestamp, org.hibernate.query.common.TemporalUnit toUnit)
    Deprecated.
    extractPattern(org.hibernate.query.common.TemporalUnit unit)
    The extract() function returns TemporalUnit.DAY_OF_WEEK numbered from 0 to 6.
     
    @Nullable String
     
    long
    microsecond is the smallest unit for an interval, and the highest precision for a timestamp, so we could use it as the "native" precision, but it's more convenient to use whole seconds (with the fractional part), since we want to use extract(epoch from ...) in our emulation of timestampdiff().
    org.hibernate.dialect.temptable.TemporaryTableStrategy
     
     
     
    getReadLockString(int timeout)
     
    getReadLockString(String aliases, int timeout)
     
    getSelectClauseNullString(int sqlType, org.hibernate.type.spi.TypeConfiguration typeConfiguration)
     
    getWriteLockString(int timeout)
     
    getWriteLockString(String aliases, int timeout)
     
    protected boolean
    Whether PostgreSQL supports `min(uuid)`/`max(uuid)` which it doesn't by default.

    Methods declared in class org.hibernate.dialect.Dialect

    addPartitionKeyToPrimaryKey, addSqlHintOrComment, addUseIndexQueryHint, appendArrayLiteral, appendBinaryLiteral, appendBooleanValueString, appendCheckConstraintOptions, appendDatetimeFormat, appendDateTimeLiteral, appendDateTimeLiteral, appendDateTimeLiteral, appendIntervalLiteral, appendIntervalLiteral, appendLiteral, appendLockHint, appendUUIDLiteral, applyLocksToSql, augmentPhysicalTableTypes, augmentRecognizedTableTypes, buildLockingClauseStrategy, buildOptimisticForceIncrementStrategy, buildOptimisticStrategy, buildPessimisticForceIncrementStrategy, buildPessimisticReadStrategy, buildPessimisticWriteStrategy, buildReadStrategy, buildSQLExceptionConversionDelegate, buildStringToBooleanCast, buildStringToBooleanCastDecode, buildStringToBooleanDecode, canCreateCatalog, canCreateSchema, canDisableConstraints, castPattern, castType, causesRollback, checkVersion, closeQuote, columnType, contribute, contributeFunctions, contributeTypes, createOptionalTableUpdateOperation, currentDate, currentLocalTime, currentLocalTimestamp, currentTime, currentTimestamp, currentTimestampWithTimeZone, defaultScrollMode, determineDatabaseVersion, doesReadCommittedCauseWritersToBlockReaders, doesRepeatableReadCauseReadersToBlockWriters, doesRoundTemporalOnOverflow, dropConstraints, equivalentTypes, escapeComment, forceLobAsLastValue, generatedAs, getAddColumnString, getAddColumnSuffixString, getAddForeignKeyConstraintString, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getAggregateSupport, getAlterColumnTypeString, getAlterTableString, getArrayTypeName, getAuxiliaryDatabaseObjectExporter, getBatchLoadSizingStrategy, getBeforeDropStatement, getCallableStatementSupport, getCascadeConstraintsString, getCaseInsensitiveLike, getCatalogSeparator, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckCondition, getCheckConstraintString, getColumnAliasExtractor, getColumnComment, getColumnDefaultString, getCreateCatalogCommand, getCreateEnumTypeCommand, getCreateEnumTypeCommand, getCreateIndexString, getCreateIndexTail, getCreateMultisetTableString, getCreateSchemaCommand, getCreateTableString, getCreateTemporaryTableColumnAnnotation, getCreateUserDefinedTypeExtensionsString, getCreateUserDefinedTypeKindString, getCrossReferenceParentTableFilter, getCurrentTimestampSelectString, getDefaultDecimalPrecision, getDefaultIntervalSecondScale, getDefaultLobLength, getDefaultNonContextualLobCreation, getDefaultProperties, getDefaultStatementBatchSize, getDefaultTimestampPrecision, getDefaultUseGetGeneratedKeys, getDisableConstraintsStatement, getDisableConstraintStatement, getDmlTargetColumnQualifierSupport, getDoublePrecision, getDropCatalogCommand, getDropEnumTypeCommand, getDropEnumTypeCommand, getDropForeignKeyString, getDropSchemaCommand, getDropTableString, getDropUniqueKeyString, getDual, getEnableConstraintsStatement, getEnableConstraintStatement, getEnumTypeDeclaration, getEnumTypeDeclaration, getFallbackSchemaManagementTool, getFallbackSqmInsertStrategy, getFallbackSqmMutationStrategy, getFloatPrecision, getForeignKeyExporter, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateSkipLockedString, getForUpdateSkipLockedString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getForUpdateString, getFromDualForSelectOnly, getFunctionalDependencyAnalysisSupport, getGlobalTemporaryTableStrategy, getGroupBySelectItemReferenceStrategy, getHqlTranslator, getIdentityColumnSupport, getIndexExporter, getInExpressionCountLimit, getInformationExtractor, getKeywords, getLimitHandler, getLobMergeStrategy, getLockingClauseStrategy, getLockingStrategy, getLockingStrategy, getLockingSupport, getLockRowIdentifier, getLowercaseFunction, getMaxAliasLength, getMaxIdentifierLength, getMaxNVarcharCapacity, getMaxNVarcharLength, getMaxTimestampPrecision, getMaxVarbinaryCapacity, getMaxVarbinaryLength, getMaxVarcharCapacity, getMaxVarcharLength, getMinimumSupportedVersion, getMultiKeyLoadSizingStrategy, getNameQualifierSupport, getNationalizationSupport, getNativeIdentifierGeneratorStrategy, getNativeParameterMarkerStrategy, getNullColumnString, getNullColumnString, getNullOrdering, getParameterCountLimit, getPersistentTemporaryTableStrategy, getPessimisticLockStyle, getPreferredSqlTypeCodeForArray, getPreferredSqlTypeCodeForBoolean, getQueryHintString, getQueryHintString, getQuerySequencesString, getReadLockString, getReadLockString, getReadRowLockStrategy, getResultSet, getResultSet, getResultSet, getRowIdColumnString, getSchemaNameResolver, getSelectClauseNullString, getSelectGUIDString, getSequenceExporter, getSequenceInformationExtractor, getSequenceSupport, getSetOperatorSqlString, getSizeStrategy, getSqlAstTranslatorFactory, getSqmTranslatorFactory, getSupportedTemporaryTableKind, getTableCleaner, getTableComment, getTableExporter, getTableMigrator, getTableTypeString, getTemporalTableSupport, getTemporaryTableAfterUseAction, getTemporaryTableBeforeUseAction, getTemporaryTableCreateCommand, getTemporaryTableCreateOptions, getTemporaryTableDdlTransactionHandling, getTemporaryTableDropCommand, getTemporaryTableExporter, getTemporaryTableTruncateCommand, getTimeoutInSeconds, getTimeZoneSupport, getTruncateTableStatement, getTruncateTableStatements, getUniqueDelegate, getUniqueKeyExporter, getUserDefinedTypeExporter, getValueLOBFragmentForExtraCreateTableInfo, getVersion, getViolatedConstraintNameExtractor, getWriteLockString, getWriteLockString, getWriteRowLockStrategy, hasAlterTable, hasDataTypeBeforeGeneratedAs, hasSelfReferentialForeignKeyBug, initDefaultProperties, initializeFunctionRegistry, isCurrentTimestampSelectStringCallable, isCurrentTimestampStable, isEmptyStringTreatedAsNull, isJdbcLogWarningsEnabledByDefault, isLob, narrowCastType, openQuote, ordinal, prependComment, qualifyIndexName, quote, quoteCollation, registerColumnTypes, registerDefaultKeywords, registerKeyword, registerKeywords, registerResultSetOutParameter, registerResultSetOutParameter, requiresCastForConcatenatingNonStrings, requiresColumnListInCreateView, requiresFloatCastingOfIntegerDivision, requiresNotNullBeforeDefault, requiresParensForTupleCounts, requiresParensForTupleDistinctCounts, resolveSqlTypeCode, resolveSqlTypeCode, resolveSqlTypeDescriptor, resolveSqlTypeLength, roundsToMaxPrecisionFirst, rowId, rowIdSqlType, stripsTrailingSpacesFromChar, supportsAlterColumnType, supportsArrayConstructor, supportsBatchUpdates, supportsBindAsCallableArgument, supportsBindingNullForSetObject, supportsBindingNullSqlTypeForSetNull, supportsBitType, supportsCascadeDelete, supportsCaseInsensitiveLike, supportsCircularCascadeDeleteConstraints, supportsColumnCheck, supportsCommentOn, supportsConflictClauseForInsertCTE, supportsCrossJoin, supportsCteHeaderColumnList, supportsCurrentTimestampSelection, supportsDistinctFromPredicate, supportsDuplicateSelectItemsInQueryGroup, supportsExceptAll, supportsExistsInSelect, supportsExpectedLobUsagePattern, supportsFetchClause, supportsFilterClause, supportsForUpdate, supportsFractionalTimestampArithmetic, supportsFromClauseInUpdate, supportsIfExistsAfterAlterTable, supportsIfExistsAfterConstraintName, supportsIfExistsAfterTableName, supportsIfExistsAfterTypeName, supportsIfExistsBeforeConstraintName, supportsIfExistsBeforeIndexName, supportsIfExistsBeforeTableName, supportsIfExistsBeforeTypeName, supportsInsertReturning, supportsInsertReturningGeneratedKeys, supportsInsertReturningRowId, supportsIntersect, supportsIsTrue, supportsJdbcConnectionLobCreation, supportsJoinInMutationStatementSubquery, supportsJoinsInDelete, supportsLateral, supportsLobValueChangePropagation, supportsLockTimeouts, supportsMaterializedLobAccess, supportsNamedColumnCheck, supportsNamedParameters, supportsNationalizedMethods, supportsNestedSubqueryCorrelation, supportsNestedWithClause, supportsNoColumnsInsert, supportsNonQueryWithCTE, supportsNotNullAfterGeneratedAs, supportsNoWait, supportsNullPrecedence, supportsOffsetInSubquery, supportsOrderByInSubquery, supportsOrdinalSelectItemReference, supportsOuterJoinForUpdate, supportsPartitionBy, supportsPredicateAsExpression, supportsRecursiveCTE, supportsRecursiveCycleClause, supportsRecursiveCycleUsingClause, supportsRecursiveSearchClause, supportsRefCursors, supportsResultSetPositionQueryMethodsOnForwardOnlyCursor, supportsRowConstructor, supportsRowValueConstructorDistinctFromSyntax, supportsRowValueConstructorGtLtSyntax, supportsRowValueConstructorSyntax, supportsRowValueConstructorSyntaxInInList, supportsRowValueConstructorSyntaxInInSubQuery, supportsRowValueConstructorSyntaxInQuantifiedPredicates, supportsSimpleQueryGrouping, supportsSkipLocked, supportsStandardArrays, supportsStandardCurrentTimestampFunction, supportsSubqueryInSelect, supportsSubqueryOnMutatingTable, supportsSubselectAsInPredicateLHS, supportsTableCheck, supportsTableOptions, supportsTemporalLiteralOffset, supportsTemporaryTablePrimaryKey, supportsTemporaryTables, supportsTruncateWithCast, supportsTupleCounts, supportsTupleDistinctCounts, supportsUnboundedLobLocatorMaterialization, supportsUnionAll, supportsUnionInSubquery, supportsUniqueConstraints, supportsUpdateReturning, supportsUserDefinedTypes, supportsValueLOBAccess, supportsValuesList, supportsValuesListForInsert, supportsWait, supportsWindowFunctions, supportsWithClause, supportsWithClauseInSubquery, throttleDdl, timestampaddPattern, timestampdiffPattern, toBooleanValueString, toQuotedIdentifier, toString, transformSelectString, translateDurationField, translateExtractField, trimPattern, unquoteGetGeneratedKeys, useArrayForMultiValuedParameters, useConnectionToCreateLob, useCrossReferenceForeignKeys, useFollowOnLocking, useInputStreamToInsertBlob, useMaterializedLobWhenCapacityExceeded

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • driverKind

      protected final org.hibernate.dialect.PostgreSQLDriverKind driverKind
  • Constructor Details

    • PostgreSQLLegacyDialect

      public PostgreSQLLegacyDialect()
    • PostgreSQLLegacyDialect

      public PostgreSQLLegacyDialect(org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfo info)
    • PostgreSQLLegacyDialect

      public PostgreSQLLegacyDialect(org.hibernate.dialect.DatabaseVersion version)
    • PostgreSQLLegacyDialect

      public PostgreSQLLegacyDialect(org.hibernate.dialect.DatabaseVersion version, org.hibernate.dialect.PostgreSQLDriverKind driverKind)
  • Method Details

    • extractPattern

      public String extractPattern(org.hibernate.query.common.TemporalUnit unit)
      The extract() function returns TemporalUnit.DAY_OF_WEEK numbered from 0 to 6. This isn't consistent with what most other databases do, so here we adjust the result by generating (extract(dow,arg)+1)).
      Overrides:
      extractPattern in class org.hibernate.dialect.Dialect
    • getFractionalSecondPrecisionInNanos

      public long getFractionalSecondPrecisionInNanos()
      microsecond is the smallest unit for an interval, and the highest precision for a timestamp, so we could use it as the "native" precision, but it's more convenient to use whole seconds (with the fractional part), since we want to use extract(epoch from ...) in our emulation of timestampdiff().
      Overrides:
      getFractionalSecondPrecisionInNanos in class org.hibernate.dialect.Dialect
    • extractField

      @Deprecated protected void extractField(StringBuilder pattern, org.hibernate.query.common.TemporalUnit unit, TemporalType fromTimestamp, TemporalType toTimestamp, org.hibernate.query.common.TemporalUnit toUnit)
      Deprecated.
    • getDefaultOrdinalityColumnName

      public @Nullable String getDefaultOrdinalityColumnName()
      Overrides:
      getDefaultOrdinalityColumnName in class org.hibernate.dialect.Dialect
    • supportsMinMaxOnUuid

      protected boolean supportsMinMaxOnUuid()
      Whether PostgreSQL supports `min(uuid)`/`max(uuid)` which it doesn't by default. Since the emulation is not very performant, this can be overridden by users which make sure that an aggregate function for uuid exists on their database. The following definitions can be used for this purpose: create or replace function min(uuid, uuid) returns uuid immutable parallel safe language plpgsql as $$ begin return least($1, $2); end $$; create aggregate min(uuid) ( sfunc = min, stype = uuid, combinefunc = min, parallel = safe, sortop = operator (<) ); create or replace function max(uuid, uuid) returns uuid immutable parallel safe language plpgsql as $$ begin return greatest($1, $2); end $$; create aggregate max(uuid) ( sfunc = max, stype = uuid, combinefunc = max, parallel = safe, sortop = operator (>) );
    • getCurrentSchemaCommand

      public String getCurrentSchemaCommand()
      Overrides:
      getCurrentSchemaCommand in class org.hibernate.dialect.Dialect
    • getNoColumnsInsertString

      public String getNoColumnsInsertString()
      Overrides:
      getNoColumnsInsertString in class org.hibernate.dialect.Dialect
    • getNativeValueGenerationStrategy

      public GenerationType getNativeValueGenerationStrategy()
      Overrides:
      getNativeValueGenerationStrategy in class org.hibernate.dialect.Dialect
    • getSelectClauseNullString

      public String getSelectClauseNullString(int sqlType, org.hibernate.type.spi.TypeConfiguration typeConfiguration)
      Overrides:
      getSelectClauseNullString in class org.hibernate.dialect.Dialect
    • buildIdentifierHelper

      public org.hibernate.engine.jdbc.env.spi.IdentifierHelper buildIdentifierHelper(org.hibernate.engine.jdbc.env.spi.IdentifierHelperBuilder builder, DatabaseMetaData metadata) throws SQLException
      Overrides:
      buildIdentifierHelper in class org.hibernate.dialect.Dialect
      Throws:
      SQLException
    • getLocalTemporaryTableStrategy

      public org.hibernate.dialect.temptable.TemporaryTableStrategy getLocalTemporaryTableStrategy()
      Overrides:
      getLocalTemporaryTableStrategy in class org.hibernate.dialect.Dialect
    • datetimeFormat

      public org.hibernate.dialect.Replacer datetimeFormat(String format)
    • getWriteLockString

      public String getWriteLockString(int timeout)
      Overrides:
      getWriteLockString in class org.hibernate.dialect.Dialect
    • getWriteLockString

      public String getWriteLockString(String aliases, int timeout)
      Overrides:
      getWriteLockString in class org.hibernate.dialect.Dialect
    • getReadLockString

      public String getReadLockString(int timeout)
      Overrides:
      getReadLockString in class org.hibernate.dialect.Dialect
    • getReadLockString

      public String getReadLockString(String aliases, int timeout)
      Overrides:
      getReadLockString in class org.hibernate.dialect.Dialect
    • contributePostgreSQLTypes

      protected void contributePostgreSQLTypes(org.hibernate.boot.model.TypeContributions typeContributions, org.hibernate.service.ServiceRegistry serviceRegistry)
    • canBatchTruncate

      public boolean canBatchTruncate()
      Overrides:
      canBatchTruncate in class org.hibernate.dialect.Dialect
      Returns:
      true, but only because we can "batch" truncate