Class SpannerPostgreSQLDialect

All Implemented Interfaces:
FunctionContributor, TypeContributor, ConversionContext

public class SpannerPostgreSQLDialect extends PostgreSQLDialect
  • Field Details

    • MINIMUM_POSTGRES_VERSION

      protected static final DatabaseVersion MINIMUM_POSTGRES_VERSION
  • Constructor Details

    • SpannerPostgreSQLDialect

      public SpannerPostgreSQLDialect()
    • SpannerPostgreSQLDialect

      public SpannerPostgreSQLDialect(DialectResolutionInfo info)
    • SpannerPostgreSQLDialect

      public SpannerPostgreSQLDialect(DatabaseVersion version)
  • Method Details

    • initializeFunctionRegistry

      public void initializeFunctionRegistry(FunctionContributions functionContributions)
      Description copied from class: Dialect
      Initialize the given registry with any dialect-specific functions.

      Support for certain SQL functions is required, and if the database does not support a required function, then the dialect must define a way to emulate it.

      These required functions include the functions defined by the JPA query language specification:

      • avg(arg) - aggregate function
      • count([distinct ]arg) - aggregate function
      • max(arg) - aggregate function
      • min(arg) - aggregate function
      • sum(arg) - aggregate function
      • coalesce(arg0, arg1, ...)
      • nullif(arg0, arg1)
      • lower(arg)
      • upper(arg)
      • length(arg)
      • concat(arg0, arg1, ...)
      • locate(pattern, string[, start])
      • substring(string, start[, length])
      • trim([[spec ][character ]from] string)
      • abs(arg)
      • mod(arg0, arg1)
      • sqrt(arg)
      • current date
      • current time
      • current timestamp
      Along with an additional set of functions defined by ANSI SQL:
      • any(arg) - aggregate function
      • every(arg) - aggregate function
      • var_samp(arg) - aggregate function
      • var_pop(arg) - aggregate function
      • stddev_samp(arg) - aggregate function
      • stddev_pop(arg) - aggregate function
      • cast(arg as Type)
      • extract(field from arg)
      • ln(arg)
      • exp(arg)
      • power(arg0, arg1)
      • floor(arg)
      • ceiling(arg)
      • position(pattern in string)
      • substring(string from start[ for length])
      • overlay(string placing replacement from start[ for length])
      And the following functions for working with java.time types:
      • local date
      • local time
      • local datetime
      • offset datetime
      • instant
      And a number of additional "standard" functions:
      • left(string, length)
      • right(string, length)
      • replace(string, pattern, replacement)
      • pad(string with length spec[ character])
      • repeat(string, times)
      • pi
      • log10(arg)
      • log(base, arg)
      • sign(arg)
      • sin(arg)
      • cos(arg)
      • tan(arg)
      • asin(arg)
      • acos(arg)
      • atan(arg)
      • atan2(arg0, arg1)
      • round(arg0[, arg1])
      • truncate(arg0[, arg1])
      • sinh(arg)
      • tanh(arg)
      • cosh(arg)
      • least(arg0, arg1, ...)
      • greatest(arg0, arg1, ...)
      • degrees(arg)
      • radians(arg)
      • bitand(arg1, arg1)
      • bitor(arg1, arg1)
      • bitxor(arg1, arg1)
      • format(datetime as pattern)
      • collate(string as collation)
      • str(arg) - synonym of cast(a as String)
      • ifnull(arg0, arg1) - synonym of coalesce(a, b)
      • ordinal(arg)
      • string(arg)
      Finally, the following functions are defined as abbreviations for extract(), and desugared by the parser:
      • second(arg) - synonym of extract(second from a)
      • minute(arg) - synonym of extract(minute from a)
      • hour(arg) - synonym of extract(hour from a)
      • day(arg) - synonym of extract(day from a)
      • month(arg) - synonym of extract(month from a)
      • year(arg) - synonym of extract(year from a)
      Note that according to this definition, the second() function returns a floating point value, contrary to the integer type returned by the native function with this name on many databases. Thus, we don't just naively map these HQL functions to the native SQL functions with the same names.
      Overrides:
      initializeFunctionRegistry in class PostgreSQLDialect
    • registerJsonFunction

      protected void registerJsonFunction(CommonFunctionFactory functionFactory)
      Overrides:
      registerJsonFunction in class PostgreSQLDialect
    • registerArrayFunctions

      protected void registerArrayFunctions(CommonFunctionFactory functionFactory)
      Overrides:
      registerArrayFunctions in class PostgreSQLDialect
    • registerXmlFunctions

      protected void registerXmlFunctions(CommonFunctionFactory functionFactory)
      Overrides:
      registerXmlFunctions in class PostgreSQLDialect
    • registerUtilityFunctions

      protected void registerUtilityFunctions(FunctionContributions functionContributions)
      Overrides:
      registerUtilityFunctions in class PostgreSQLDialect
    • initDefaultProperties

      protected void initDefaultProperties()
      Description copied from class: Dialect
      Set appropriate default values for configuration properties.

      This default implementation sets "hibernate.jdbc.batch_size", "hibernate.jdbc.lob.non_contextual_creation", and "hibernate.jdbc.use_get_generated_keys" to defaults determined by calling Dialect.getDefaultStatementBatchSize(), Dialect.getDefaultNonContextualLobCreation(), and Dialect.getDefaultUseGetGeneratedKeys().

      An implementation may set additional configuration properties, but this is discouraged.

      Overrides:
      initDefaultProperties in class Dialect
    • getArrayTypeName

      public String getArrayTypeName(String javaElementTypeName, String elementTypeName, Integer maxLength)
      Description copied from class: Dialect
      The SQL type name for the array type with elements of the given type name.

      The ANSI-standard syntax is integer array.

      Overrides:
      getArrayTypeName in class Dialect
    • getTableExporter

      public org.hibernate.tool.schema.internal.StandardTableExporter getTableExporter()
      Description copied from class: Dialect
      Get an Exporter for Tables, usually StandardTableExporter.
      Overrides:
      getTableExporter in class PostgreSQLDialect
    • getUniqueDelegate

      public UniqueDelegate getUniqueDelegate()
      Description copied from class: Dialect
      Get the UniqueDelegate supported by this dialect
      Overrides:
      getUniqueDelegate in class PostgreSQLDialect
      Returns:
      The UniqueDelegate
    • getSequenceSupport

      public SequenceSupport getSequenceSupport()
      Description copied from class: Dialect
      Get the appropriate SequenceSupport for this dialect.
      Overrides:
      getSequenceSupport in class PostgreSQLDialect
    • getLimitHandler

      public LimitHandler getLimitHandler()
      Description copied from class: Dialect
      Obtain a LimitHandler that implements pagination support for Query.setMaxResults(int) and Query.setFirstResult(int).
      Overrides:
      getLimitHandler in class PostgreSQLDialect
    • getCheckCondition

      public String getCheckCondition(String columnName, String[] values)
      Description copied from class: Dialect
      Render a SQL check condition for a column that represents an enumerated value by its string representation or a given list of values (with NULL value allowed).
      Overrides:
      getCheckCondition in class Dialect
      Returns:
      a SQL expression that will occur in a check constraint
    • getCheckCondition

      public String getCheckCondition(String columnName, Long[] values)
      Description copied from class: Dialect
      Render a SQL check condition for a column that represents an enumerated value by its ordinal representation or a given list of values.
      Overrides:
      getCheckCondition in class Dialect
      Returns:
      a SQL expression that will occur in a check constraint
    • getCheckCondition

      public String getCheckCondition(String columnName, Collection<?> valueSet, JdbcType jdbcType)
      Description copied from class: Dialect
      Generate a SQL check condition for the given column, constraining to the given values.
      Overrides:
      getCheckCondition in class Dialect
      Returns:
      a SQL expression that will occur in a check constraint
    • getAggregateSupport

      public AggregateSupport getAggregateSupport()
      Description copied from class: Dialect
      How does this dialect support aggregate types like SqlTypes.STRUCT.
      Overrides:
      getAggregateSupport in class PostgreSQLDialect
    • getLockingSupport

      public LockingSupport getLockingSupport()
      Description copied from class: Dialect
      Access to various details and operations related to this Dialect's support for pessimistic locking.
      Overrides:
      getLockingSupport in class PostgreSQLDialect
    • resolveSqlTypeCode

      protected Integer resolveSqlTypeCode(String columnTypeName, TypeConfiguration typeConfiguration)
      Description copied from class: Dialect
      Resolves the SqlTypes type code for the given column type name as reported by the database, or null if it can't be resolved.
      Overrides:
      resolveSqlTypeCode in class PostgreSQLDialect
    • supportsFetchClause

      public boolean supportsFetchClause(FetchClauseType type)
      Description copied from class: Dialect
      Does this dialect support the given FETCH clause type.
      Overrides:
      supportsFetchClause in class PostgreSQLDialect
      Parameters:
      type - The fetch clause type
      Returns:
      true if the underlying database supports the given fetch clause type, false otherwise. The default is false.
    • getForUpdateString

      public String getForUpdateString()
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire pessimistic UPGRADE locks for this dialect.
      Overrides:
      getForUpdateString in class PostgreSQLDialect
      Returns:
      The appropriate FOR UPDATE clause string.
    • getForUpdateString

      public String getForUpdateString(String aliases)
      Description copied from class: Dialect
      Get the FOR UPDATE OF column_list fragment appropriate for this dialect, given the aliases of the columns that are to be write-locked.
      Overrides:
      getForUpdateString in class PostgreSQLDialect
      Parameters:
      aliases - The columns to be write-locked.
      Returns:
      The appropriate FOR UPDATE OF column_list clause string.
    • getWriteLockString

      public String getWriteLockString(int timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire pessimistic WRITE locks for this dialect.

      Location of the returned string is treated the same as Dialect.getForUpdateString().

      Overrides:
      getWriteLockString in class PostgreSQLDialect
      Parameters:
      timeout - How long, in milliseconds, the database should wait to acquire the lock. See Timeouts for some "magic values".
      Returns:
      The appropriate LOCK clause string.
    • getWriteLockString

      public String getWriteLockString(String aliases, int timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire WRITE locks for this dialect, given the aliases of the columns to be WRITE locked.

      Location of the returned string is treated the same as Dialect.getForUpdateString().

      Overrides:
      getWriteLockString in class PostgreSQLDialect
      Parameters:
      aliases - The columns to be read locked.
      timeout - How long, in milliseconds, the database should wait to acquire the lock. See Timeouts for some "magic values".
      Returns:
      The appropriate LOCK clause string.
    • getWriteLockString

      public String getWriteLockString(Timeout timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire pessimistic WRITE locks for this dialect.
      Overrides:
      getWriteLockString in class PostgreSQLDialect
      Parameters:
      timeout - How long the database should wait to acquire the lock. See Timeouts for some "magic values".
      Returns:
      The appropriate lock clause.
    • getWriteLockString

      public String getWriteLockString(String aliases, Timeout timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire WRITE locks for this dialect, given the aliases of the columns to be WRITE locked. * * @param timeout How long the database should wait to acquire the lock.

      Location of the returned string is treated the same as Dialect.getForUpdateString().

      Overrides:
      getWriteLockString in class PostgreSQLDialect
      Parameters:
      aliases - The columns to be read locked.
      timeout - How long the database should wait to acquire the lock. See Timeouts for some "magic values".
      Returns:
      The appropriate LOCK clause string.
    • getReadLockString

      public String getReadLockString(int timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire READ locks for this dialect.

      Location of the returned string is treated the same as Dialect.getForUpdateString().

      Overrides:
      getReadLockString in class PostgreSQLDialect
      Parameters:
      timeout - in milliseconds, -1 for indefinite wait and 0 for no wait.
      Returns:
      The appropriate LOCK clause string.
    • getReadLockString

      public String getReadLockString(Timeout timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire READ locks for this dialect.
      Overrides:
      getReadLockString in class PostgreSQLDialect
      Parameters:
      timeout - How long the database should wait to acquire the lock. See Timeouts for some "magic values".
      Returns:
      The appropriate LOCK clause string.
    • getReadLockString

      public String getReadLockString(String aliases, Timeout timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire READ locks for this dialect, given the aliases of the columns to be read locked.
      Overrides:
      getReadLockString in class PostgreSQLDialect
      Parameters:
      aliases - The columns to be read locked.
      timeout - How long the database should wait to acquire the lock. See Timeouts for some "magic values".
      Returns:
      The appropriate LOCK clause string.
    • getReadLockString

      public String getReadLockString(String aliases, int timeout)
      Description copied from class: Dialect
      Get the string to append to SELECT statements to acquire READ locks for this dialect, given the aliases of the columns to be read locked.

      Location of the returned string is treated the same as Dialect.getForUpdateString().

      Overrides:
      getReadLockString in class PostgreSQLDialect
      Parameters:
      aliases - The columns to be read locked.
      timeout - in milliseconds, -1 for indefinite wait and 0 for no wait.
      Returns:
      The appropriate LOCK clause string.
    • getForUpdateNowaitString

      public String getForUpdateNowaitString()
      Description copied from class: Dialect
      Retrieves the FOR UPDATE NOWAIT syntax specific to this dialect.
      Overrides:
      getForUpdateNowaitString in class PostgreSQLDialect
      Returns:
      The appropriate FOR UPDATE NOWAIT clause string.
    • getForUpdateNowaitString

      public String getForUpdateNowaitString(String aliases)
      Description copied from class: Dialect
      Get the FOR UPDATE OF column_list NOWAIT fragment appropriate for this dialect, given the aliases of the columns to be write locked.
      Overrides:
      getForUpdateNowaitString in class PostgreSQLDialect
      Parameters:
      aliases - The columns to be write locked.
      Returns:
      The appropriate FOR UPDATE OF colunm_list NOWAIT clause string.
    • getForUpdateSkipLockedString

      public String getForUpdateSkipLockedString()
      Description copied from class: Dialect
      Retrieves the FOR UPDATE SKIP LOCKED syntax specific to this dialect.
      Overrides:
      getForUpdateSkipLockedString in class PostgreSQLDialect
      Returns:
      The appropriate FOR UPDATE SKIP LOCKED clause string.
    • getForUpdateSkipLockedString

      public String getForUpdateSkipLockedString(String aliases)
      Description copied from class: Dialect
      Get the FOR UPDATE OF column_list SKIP LOCKED fragment appropriate for this dialect, given the aliases of the columns to be write-locked.
      Overrides:
      getForUpdateSkipLockedString in class PostgreSQLDialect
      Parameters:
      aliases - The columns to be write-locked.
      Returns:
      The appropriate FOR UPDATE colunm_list SKIP LOCKED clause string.
    • getLockingClauseStrategy

      public LockingClauseStrategy getLockingClauseStrategy(QuerySpec querySpec, LockOptions lockOptions)
      Description copied from class: Dialect
      Strategy for handling locking clause as part of SqlAstTranslator.
      Overrides:
      getLockingClauseStrategy in class Dialect
    • contributeTypes

      public void contributeTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
      Description copied from class: Dialect
      A callback which allows the Dialect to contribute types.
      Overrides:
      contributeTypes in class PostgreSQLDialect
      Parameters:
      typeContributions - Callback to contribute the types
      serviceRegistry - The service registry
    • getFunctionalDependencyAnalysisSupport

      public FunctionalDependencyAnalysisSupport getFunctionalDependencyAnalysisSupport()
      Description copied from class: Dialect
      Get this dialect's level of support for primary key functional dependency analysis within GROUP BY and ORDER BY clauses.
      Overrides:
      getFunctionalDependencyAnalysisSupport in class PostgreSQLDialect
    • contributePostgreSQLTypes

      protected void contributePostgreSQLTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
      Description copied from class: PostgreSQLDialect
      Allow for extension points to override this only
      Overrides:
      contributePostgreSQLTypes in class PostgreSQLDialect
    • getSqlAstTranslatorFactory

      public SqlAstTranslatorFactory getSqlAstTranslatorFactory()
      Description copied from class: Dialect
      Return a SqlAstTranslatorFactory specific to this dialect, or null to use the standard translator.
      Overrides:
      getSqlAstTranslatorFactory in class PostgreSQLDialect
      See Also:
    • registerPostgreSQLColumnTypes

      protected void registerPostgreSQLColumnTypes(TypeContributions typeContributions, ServiceRegistry serviceRegistry)
      Overrides:
      registerPostgreSQLColumnTypes in class PostgreSQLDialect
    • appendDateTimeLiteral

      public void appendDateTimeLiteral(SqlAppender appender, TemporalAccessor temporalAccessor, TemporalType precision, TimeZone jdbcTimeZone)
      Description copied from class: Dialect
      Append a datetime literal representing the given java.time value to the given SqlAppender.
      Overrides:
      appendDateTimeLiteral in class PostgreSQLDialect
    • appendDateTimeLiteral

      public void appendDateTimeLiteral(SqlAppender appender, Date date, TemporalType precision, TimeZone jdbcTimeZone)
      Description copied from class: Dialect
      Append a datetime literal representing the given Date value to the given SqlAppender.
      Overrides:
      appendDateTimeLiteral in class PostgreSQLDialect
    • appendDateTimeLiteral

      public void appendDateTimeLiteral(SqlAppender appender, Calendar calendar, TemporalType precision, TimeZone jdbcTimeZone)
      Description copied from class: Dialect
      Append a datetime literal representing the given Calendar value to the given SqlAppender.
      Overrides:
      appendDateTimeLiteral in class PostgreSQLDialect
    • castType

      protected String castType(int sqlTypeCode)
      Description copied from class: Dialect
      The SQL type to use in cast( ... as ... ) expressions when casting to the target type represented by the given JDBC type code.
      Overrides:
      castType in class PostgreSQLDialect
      Parameters:
      sqlTypeCode - The JDBC type code representing the target type
      Returns:
      The SQL type to use in cast()
    • timestampaddPattern

      public String timestampaddPattern(TemporalUnit unit, TemporalType temporalType, IntervalType intervalType)
      Description copied from class: Dialect
      Obtain a pattern for the SQL equivalent to a timestampadd() function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.
      Overrides:
      timestampaddPattern in class PostgreSQLDialect
      Parameters:
      unit - The unit to add to the temporal
      temporalType - The type of the temporal
      intervalType - The type of interval to add or null if it's not a native interval
    • timestampdiffPattern

      public String timestampdiffPattern(TemporalUnit unit, TemporalType fromTemporalType, TemporalType toTemporalType)
      Description copied from class: Dialect
      Obtain a pattern for the SQL equivalent to a timestampdiff() function call. The resulting pattern must contain ?1, ?2, and ?3 placeholders for the arguments.
      Overrides:
      timestampdiffPattern in class PostgreSQLDialect
      Parameters:
      unit - the first argument
      fromTemporalType - true if the first argument is a timestamp, false if a date
      toTemporalType - true if the second argument is
    • castPattern

      public String castPattern(CastType from, CastType to)
      Description copied from class: Dialect
      Obtain a pattern for the SQL equivalent to a cast() function call. The resulting pattern must contain ?1 and ?2 placeholders for the arguments.
      Overrides:
      castPattern in class PostgreSQLDialect
      Parameters:
      from - a CastType indicating the type of the value argument
      to - a CastType indicating the type the value argument is cast to
    • columnType

      protected String columnType(int sqlTypeCode)
      Description copied from class: Dialect
      The database column type name for a given JDBC type code defined in Types or SqlTypes. This default implementation returns the ANSI-standard type name.

      This method may be overridden by concrete Dialects as an alternative to Dialect.registerColumnTypes(TypeContributions, ServiceRegistry) for simple registrations.

      Note that:

      1. Implementations of this method are expected to define a sensible mapping forTypes.NCLOB Types.NCHAR, and Types.NVARCHAR. On some database, these types are simply remapped to CLOB, CHAR, and VARCHAR.
      2. Mappings for Types.TIMESTAMP and Types.TIMESTAMP_WITH_TIMEZONE should support explicit specification of precision if possible.
      3. As specified by DdlTypeRegistry.getDescriptor(int), this method never receives Types.LONGVARCHAR, Types.LONGNVARCHAR, nor Types.LONGVARBINARY, which are considered synonyms for their non-LONG counterparts.
      4. On the other hand, the types SqlTypes.LONG32VARCHAR, SqlTypes.LONG32NVARCHAR, and SqlTypes.LONG32VARBINARY are not synonyms, and implementations of this method must define sensible mappings, for example to database-native TEXT or CLOB types.
      Overrides:
      columnType in class PostgreSQLDialect
      Parameters:
      sqlTypeCode - a SQL type code
      Returns:
      a column type name, with $l, $p, $s placeholders for length, precision, scale
      See Also:
    • defaultScrollMode

      public ScrollMode defaultScrollMode()
      Description copied from class: Dialect
      A default ScrollMode to be used by Query.scroll().
      Overrides:
      defaultScrollMode in class Dialect
      Returns:
      the default ScrollMode to use.
    • supportsTupleCounts

      public boolean supportsTupleCounts()
      Description copied from class: Dialect
      Does this dialect support count(a,b)?
      Overrides:
      supportsTupleCounts in class PostgreSQLDialect
      Returns:
      True if the database supports counting tuples; false otherwise.
    • supportsUserDefinedTypes

      public boolean supportsUserDefinedTypes()
      Description copied from class: Dialect
      Does the database support user-defined types?
      Overrides:
      supportsUserDefinedTypes in class PostgreSQLDialect
      See Also:
    • supportsFilterClause

      public boolean supportsFilterClause()
      Description copied from class: Dialect
      Whether the FILTER clause for aggregate functions is supported.
      Overrides:
      supportsFilterClause in class PostgreSQLDialect
    • supportsRecursiveCycleUsingClause

      public boolean supportsRecursiveCycleUsingClause()
      Description copied from class: Dialect
      Whether the SQL cycle clause supports the using sub-clause.
      Overrides:
      supportsRecursiveCycleUsingClause in class PostgreSQLDialect
    • supportsRecursiveSearchClause

      public boolean supportsRecursiveSearchClause()
      Description copied from class: Dialect
      Whether the SQL search clause is supported, which can be used for recursive CTEs.
      Overrides:
      supportsRecursiveSearchClause in class PostgreSQLDialect
    • supportsUniqueConstraints

      public boolean supportsUniqueConstraints()
      Overrides:
      supportsUniqueConstraints in class Dialect
      Returns:
      True if database supports UNIQUE constraint definitions in the create table and alter table statements. If this is not supported, then Hibernate will create a unique index instead.
    • supportsRowValueConstructorGtLtSyntax

      public boolean supportsRowValueConstructorGtLtSyntax()
      Description copied from class: Dialect
      Is this dialect known to support what ANSI SQL calls the row value constructor syntax with the < >, <= and >= operators.

      That is, does it support comparisons like:

      (FIRST_NAME, LAST_NAME) < ('Steve', 'Ebersole')
      Overrides:
      supportsRowValueConstructorGtLtSyntax in class Dialect
      Returns:
      True if this SQL dialect is known to support the use of row value constructors as operands of relational comparison operators; false otherwise.
    • supportsRowValueConstructorSyntax

      public boolean supportsRowValueConstructorSyntax()
      Description copied from class: Dialect
      Is this dialect known to support what ANSI SQL calls the row value constructor syntax, sometimes called "tuples".

      That is, does it support comparisons like:

      (FIRST_NAME, LAST_NAME) = ('Steve', 'Ebersole')
      Overrides:
      supportsRowValueConstructorSyntax in class Dialect
      Returns:
      True if this SQL dialect is known to support the use of row value constructors as operands of the equality operator; false otherwise.
    • supportsRowValueConstructorSyntaxInQuantifiedPredicates

      public boolean supportsRowValueConstructorSyntaxInQuantifiedPredicates()
      Description copied from class: Dialect
      Is this dialect known to support what ANSI SQL calls the row value constructor syntax with quantified predicates.

      That is, does it support comparisons like:

      (FIRST_NAME, LAST_NAME) = ALL (select ...)
      Overrides:
      supportsRowValueConstructorSyntaxInQuantifiedPredicates in class Dialect
      Returns:
      True if this SQL dialect is known to support the use of row value constructors as operands with quantified predicates; false otherwise.
    • supportsValuesList

      public boolean supportsValuesList()
      Description copied from class: Dialect
      Does this dialect support values lists of form VALUES (1), (2), (3)?
      Overrides:
      supportsValuesList in class PostgreSQLDialect
      Returns:
      true if values list are supported
    • supportsRowValueConstructorSyntaxInInSubQuery

      public boolean supportsRowValueConstructorSyntaxInInSubQuery()
      Description copied from class: Dialect
      If the dialect supports row value constructors, does it allow them in IN subqueries?

      For example:

      (FIRST_NAME, LAST_NAME) IN (SELECT ... )
      Overrides:
      supportsRowValueConstructorSyntaxInInSubQuery in class Dialect
      Returns:
      True if this SQL dialect is known to support the use of row value constructors in IN subqueries; false otherwise.
    • supportsCaseInsensitiveLike

      public boolean supportsCaseInsensitiveLike()
      Description copied from class: Dialect
      Does this dialect support case-insensitive LIKE comparisons?
      Overrides:
      supportsCaseInsensitiveLike in class PostgreSQLDialect
      Returns:
      true if the database supports case-insensitive like comparisons, false otherwise. The default is false.
    • currentTimestamp

      public String currentTimestamp()
      Description copied from class: Dialect
      Translation of the HQL/JPQL current_timestamp function, which maps to the Java type Timestamp which is a datetime with no time zone. This contradicts ANSI SQL where current_timestamp has the type TIMESTAMP WITH TIME ZONE.

      It is recommended to override this in dialects for databases which support localtimestamp or timestamp at local.

      Overrides:
      currentTimestamp in class PostgreSQLDialect
    • currentTime

      public String currentTime()
      Description copied from class: Dialect
      Translation of the HQL/JPQL current_time function, which maps to the Java type Time which is a time with no time zone. This contradicts ANSI SQL where current_time has the type TIME WITH TIME ZONE.

      It is recommended to override this in dialects for databases which support localtime or time at local.

      Overrides:
      currentTime in class PostgreSQLDialect
    • currentLocalTimestamp

      public String currentLocalTimestamp()
      Description copied from class: Dialect
      Translation of the HQL local_datetime function, which maps to the Java type LocalDateTime which is a datetime with no time zone. It should usually be the same SQL function as for Dialect.currentTimestamp().

      It is recommended to override this in dialects for databases which support localtimestamp or current_timestamp at local.

      Overrides:
      currentLocalTimestamp in class Dialect
    • currentLocalTime

      public String currentLocalTime()
      Description copied from class: Dialect
      Translation of the HQL local_time function, which maps to the Java type LocalTime which is a time with no time zone. It should usually be the same SQL function as for Dialect.currentTime().

      It is recommended to override this in dialects for databases which support localtime or current_time at local.

      Overrides:
      currentLocalTime in class Dialect
    • supportsLateral

      public boolean supportsLateral()
      Description copied from class: Dialect
      Does this dialect support the SQL lateral keyword or a proprietary alternative?
      Overrides:
      supportsLateral in class PostgreSQLDialect
      Returns:
      true if the underlying database supports lateral, false otherwise. The default is false.
    • supportsFromClauseInUpdate

      public boolean supportsFromClauseInUpdate()
      Description copied from class: Dialect
      Does this dialect support the from clause for update statements?
      Overrides:
      supportsFromClauseInUpdate in class PostgreSQLDialect
      Returns:
      true if from clause is supported
    • getMaxVarcharLength

      public int getMaxVarcharLength()
      Description copied from class: Dialect
      The biggest size value that can be supplied as argument to a Types.VARCHAR-like type.

      For longer column lengths, use some sort of text-like type for the column.

      Overrides:
      getMaxVarcharLength in class PostgreSQLDialect
    • getMaxVarbinaryLength

      public int getMaxVarbinaryLength()
      Description copied from class: Dialect
      The biggest size value that can be supplied as argument to a Types.VARBINARY-like type.

      For longer column lengths, use some sort of image-like type for the column.

      Overrides:
      getMaxVarbinaryLength in class PostgreSQLDialect
    • getCurrentSchemaCommand

      public String getCurrentSchemaCommand()
      Description copied from class: Dialect
      Get the SQL command used to retrieve the current schema name.

      Works in conjunction with Dialect.getSchemaNameResolver(), unless the resulting SchemaNameResolver does not need this information. For example, a custom implementation might make use of the Java 1.7 Connection.getSchema() method.

      Overrides:
      getCurrentSchemaCommand in class PostgreSQLDialect
      Returns:
      The current schema retrieval SQL
    • supportsCommentOn

      public boolean supportsCommentOn()
      Description copied from class: Dialect
      Does this dialect support commenting on tables and columns?
      Overrides:
      supportsCommentOn in class PostgreSQLDialect
      Returns:
      true if commenting is supported
    • supportsWindowFunctions

      public boolean supportsWindowFunctions()
      Description copied from class: Dialect
      Does this dialect support window functions like row_number() over (..)?
      Overrides:
      supportsWindowFunctions in class PostgreSQLDialect
      Returns:
      true if the underlying database supports window functions, false otherwise. The default is false.
    • getInExpressionCountLimit

      public int getInExpressionCountLimit()
      Description copied from class: Dialect
      Return the limit that the underlying database places on the number of elements in an IN predicate. If the database defines no such limits, simply return zero or a number smaller than zero.
      Overrides:
      getInExpressionCountLimit in class Dialect
      Returns:
      The limit, or a non-positive integer to indicate no limit.
    • getAddForeignKeyConstraintString

      public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey)
      Description copied from class: Dialect
      The syntax used to add a foreign key constraint to a table, with the referenced key columns explicitly specified.
      Overrides:
      getAddForeignKeyConstraintString in class Dialect
      Parameters:
      constraintName - The foreign key constraint name
      foreignKey - The names of the columns comprising the foreign key
      referencedTable - The table referenced by the foreign key
      primaryKey - The explicit columns in the referencedTable referenced by this foreign key.
      referencesPrimaryKey - if false, constraint should be explicit about which column names the constraint refers to
      Returns:
      the "add FK" fragment
    • canBatchTruncate

      public boolean canBatchTruncate()
      Description copied from class: Dialect
      Does the truncate table statement accept multiple tables?
      Overrides:
      canBatchTruncate in class PostgreSQLDialect
      Returns:
      true, but only because we can "batch" truncate
    • rowId

      public String rowId(String rowId)
      Description copied from class: Dialect
      The name of a rowid-like pseudo-column which acts as a high-performance row locator, or null if this dialect has no such pseudo-column.

      If the rowid-like value is an explicitly declared named column instead of an implicit pseudo-column, and if the given name is nonempty, return the given name.

      Overrides:
      rowId in class PostgreSQLDialect
      Parameters:
      rowId - the name specified by RowId.value(), which is ignored if Dialect.getRowIdColumnString(String) is not overridden
    • supportsRowConstructor

      public boolean supportsRowConstructor()
      Description copied from class: Dialect
      Whether the SQL row constructor is supported.
      Overrides:
      supportsRowConstructor in class PostgreSQLDialect
    • getTruncateTableStatement

      public String getTruncateTableStatement(String tableName)
      Description copied from class: Dialect
      A SQL statement that truncates the given table.
      Overrides:
      getTruncateTableStatement in class Dialect
      Parameters:
      tableName - the name of the table
    • getBeforeDropStatement

      public String getBeforeDropStatement()
      Description copied from class: Dialect
      A command to execute before dropping tables.
      Overrides:
      getBeforeDropStatement in class PostgreSQLDialect
      Returns:
      A SQL statement, or null
    • getCascadeConstraintsString

      public String getCascadeConstraintsString()
      Description copied from class: Dialect
      The keyword that specifies that a drop table operation should be cascaded to its constraints, typically " cascade" where the leading space is required, or the empty string if there is no such keyword in this dialect.
      Overrides:
      getCascadeConstraintsString in class PostgreSQLDialect
      Returns:
      The cascade drop keyword, if any, with a leading space
    • supportsIfExistsBeforeConstraintName

      public boolean supportsIfExistsBeforeConstraintName()
      Description copied from class: Dialect
      For dropping a constraint with an alter table statement, can the phrase if exists be applied before the constraint name?
      Overrides:
      supportsIfExistsBeforeConstraintName in class PostgreSQLDialect
      Returns:
      true if if exists can be applied before the constraint name
    • supportsIfExistsAfterAlterTable

      public boolean supportsIfExistsAfterAlterTable()
      Description copied from class: Dialect
      For an alter table, can the phrase if exists be applied?
      Overrides:
      supportsIfExistsAfterAlterTable in class PostgreSQLDialect
      Returns:
      true if if exists can be applied after alter table
    • supportsDistinctFromPredicate

      public boolean supportsDistinctFromPredicate()
      Description copied from class: Dialect
      Does this dialect support some kind of distinct from predicate?

      That is, does it support syntax like:

      ... where FIRST_NAME IS DISTINCT FROM LAST_NAME
      
      Overrides:
      supportsDistinctFromPredicate in class PostgreSQLDialect
      Returns:
      True if this SQL dialect is known to support some kind of distinct from predicate; false otherwise
    • supportsPartitionBy

      public boolean supportsPartitionBy()
      Description copied from class: Dialect
      Does is dialect support partition by in window functions?
      Overrides:
      supportsPartitionBy in class PostgreSQLDialect
    • addPartitionKeyToPrimaryKey

      public boolean addPartitionKeyToPrimaryKey()
      Description copied from class: Dialect
      Does this dialect require that the columns listed in partition by also occur in the primary key, when defining table partitioning?
      Overrides:
      addPartitionKeyToPrimaryKey in class PostgreSQLDialect
    • getDual

      public String getDual()
      Description copied from class: Dialect
      Returns a table expression that has one row.
      Overrides:
      getDual in class Dialect
      Returns:
      the SQL equivalent to Oracle's dual.
    • getFromDualForSelectOnly

      public String getFromDualForSelectOnly()
      Overrides:
      getFromDualForSelectOnly in class Dialect
    • datetimeFormat

      public Replacer datetimeFormat(String format)
      Overrides:
      datetimeFormat in class PostgreSQLDialect
    • supportsRecursiveCTE

      public boolean supportsRecursiveCTE()
      Description copied from class: Dialect
      Does this dialect/database support recursive CTEs?
      Overrides:
      supportsRecursiveCTE in class PostgreSQLDialect
      Returns:
      true if recursive CTEs are supported
    • supportsWithClauseInSubquery

      public boolean supportsWithClauseInSubquery()
      Description copied from class: Dialect
      Whether the SQL with clause is supported within a subquery.
      Overrides:
      supportsWithClauseInSubquery in class Dialect
    • supportsNestedWithClause

      public boolean supportsNestedWithClause()
      Description copied from class: Dialect
      Whether the SQL with clause is supported within a CTE.
      Overrides:
      supportsNestedWithClause in class Dialect
    • supportsCteHeaderColumnList

      public boolean supportsCteHeaderColumnList()
      Description copied from class: Dialect
      Does this dialect support defining the column list in the CTE header?

      Standard syntax: WITH cte (col1, col2) AS ...

      If false, Hibernate will generate: WITH cte AS (SELECT ... AS col1, ... AS col2)

      Overrides:
      supportsCteHeaderColumnList in class Dialect
      Returns:
      true if the dialect supports the column list in the CTE header; false otherwise.
    • supportsTupleDistinctCounts

      public boolean supportsTupleDistinctCounts()
      Description copied from class: Dialect
      Does this dialect support count(distinct a,b)?
      Overrides:
      supportsTupleDistinctCounts in class Dialect
      Returns:
      True if the database supports counting distinct tuples; false otherwise.
    • getInformationExtractor

      public InformationExtractor getInformationExtractor(ExtractionContext extractionContext)
      Description copied from class: Dialect
      A InformationExtractor which is able to extract table, primary key, foreign key, index information etc. via JDBC.
      Overrides:
      getInformationExtractor in class PostgreSQLDialect
    • getFallbackSqmMutationStrategy

    • getFallbackSqmInsertStrategy

    • getLocalTemporaryTableStrategy

      public TemporaryTableStrategy getLocalTemporaryTableStrategy()
      Description copied from class: Dialect
      The strategy to use for local temporary tables.
      Overrides:
      getLocalTemporaryTableStrategy in class PostgreSQLDialect
    • getGlobalTemporaryTableStrategy

      public @Nullable TemporaryTableStrategy getGlobalTemporaryTableStrategy()
      Description copied from class: Dialect
      The strategy to use for global temporary tables.
      Overrides:
      getGlobalTemporaryTableStrategy in class Dialect
    • getPersistentTemporaryTableStrategy

      public TemporaryTableStrategy getPersistentTemporaryTableStrategy()
      Description copied from class: Dialect
      The strategy to use for persistent temporary tables.
      Overrides:
      getPersistentTemporaryTableStrategy in class Dialect
    • buildSQLExceptionConversionDelegate

      public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate()
      Description copied from class: Dialect
      An instance of SQLExceptionConversionDelegate for interpreting dialect-specific error or SQLState codes.

      If this method is overridden to return a non-null value, the default SQLExceptionConverter will use the returned SQLExceptionConversionDelegate in addition to the following standard delegates:

      1. a "static" delegate based on the JDBC4-defined SQLException hierarchy, and
      2. a delegate that interprets SQLState codes as either X/Open or SQL-2003 codes, depending on what is reported by the JDBC driver.

      It is strongly recommended that every Dialect implementation override this method, since interpretation of a SQL error is much more accurate when based on the vendor-specific error code, rather than on the SQLState.

      Overrides:
      buildSQLExceptionConversionDelegate in class PostgreSQLDialect
      Returns:
      The SQLExceptionConversionDelegate for this dialect
    • getCallableStatementSupport

      public CallableStatementSupport getCallableStatementSupport()
      Description copied from class: Dialect
      The CallableStatementSupport for this database. Does this database support returning cursors?
      Overrides:
      getCallableStatementSupport in class PostgreSQLDialect
    • useIntegerForPrimaryKey

      public boolean useIntegerForPrimaryKey()
    • createOptionalTableUpdateOperation

      public MutationOperation createOptionalTableUpdateOperation(EntityMutationTarget mutationTarget, org.hibernate.sql.model.internal.OptionalTableUpdate optionalTableUpdate, SessionFactoryImplementor factory)
      Description copied from class: Dialect
      Create a MutationOperation for a updating an optional table
      Overrides:
      createOptionalTableUpdateOperation in class PostgreSQLDialect