org.hibernate.dialect
Class PostgreSQLDialect

java.lang.Object
  extended byorg.hibernate.dialect.Dialect
      extended byorg.hibernate.dialect.PostgreSQLDialect

public class PostgreSQLDialect
extends Dialect

An SQL dialect for Postgres

Author:
Gavin King

Field Summary
 
Fields inherited from class org.hibernate.dialect.Dialect
CLOSED_QUOTE, QUOTE
 
Constructor Summary
PostgreSQLDialect()
           
 
Method Summary
 boolean bindLimitParametersInReverseOrder()
          Does the LIMIT clause specify arguments in the "reverse" order limit, offset instead of offset, limit?
 boolean dropConstraints()
          Do we need to drop constraints before dropping tables in this dialect?
 String getAddColumnString()
          The syntax used to add a column to a table (optional).
 String getCascadeConstraintsString()
          Completely optional cascading drop clause
 String getCreateSequenceString(String sequenceName)
          The syntax used to create a sequence, if sequences are supported.
 String getCreateTemporaryTablePostfix()
           
 String getCreateTemporaryTableString()
           
 String getCurrentTimestampSelectString()
           
 String getDropSequenceString(String sequenceName)
          The syntax used to drop a sequence, if sequences are supported.
 String getForUpdateString(String aliases)
          Does this dialect support the FOR UPDATE OF syntax?
 String getIdentityColumnString(int type)
          The keyword used to specify an identity column, if identity column key generation is supported.
 String getIdentitySelectString(String table, String column, int type)
          The syntax that returns the identity value of the last insert, if identity column key generation is supported.
 String getLimitString(String sql, boolean hasOffset)
          Add a LIMIT clause to the given SQL SELECT
 Class getNativeIdentifierGeneratorClass()
           
 String getNoColumnsInsertString()
          The keyword used to insert a row without specifying any column values.
 String getQuerySequencesString()
          A query used to find all sequences
 String getSelectClauseNullString(int sqlType)
          Workaround for postgres bug #1453
 String getSelectSequenceNextValString(String sequenceName)
          Generate the select expression fragment that will retreive the next value of a sequence, if sequences are supported.
 String getSequenceNextValString(String sequenceName)
          Generate the appropriate select statement to to retreive the next value of a sequence, if sequences are supported.
 ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter()
           
 boolean hasDataTypeInIdentityColumn()
          Whether this dialect have an Identity clause added to the data type or a completely seperate identity data type
 boolean isCurrentTimestampSelectStringCallable()
           
 boolean supportsCommentOn()
           
 boolean supportsCurrentTimestampSelection()
           
 boolean supportsIdentityColumns()
          Does this dialect support identity column key generation?
 boolean supportsLimit()
          Does this Dialect have some kind of LIMIT syntax?
 boolean supportsOuterJoinForUpdate()
           
 boolean supportsSequences()
          Does this dialect support sequences?
 boolean supportsTemporaryTables()
           
 boolean supportsUnionAll()
           
 String toBooleanValueString(boolean bool)
          The SQL value that the JDBC driver maps boolean values to
 boolean useInputStreamToInsertBlob()
           
 
Methods inherited from class org.hibernate.dialect.Dialect
appendIdentitySelectToInsert, appendLockHint, bindLimitParametersFirst, buildSQLExceptionConverter, closeQuote, createCaseFragment, createOuterJoinFragment, dropTemporaryTableAfterUse, forUpdateOfColumns, generateTemporaryTableName, getAddForeignKeyConstraintString, getAddPrimaryKeyConstraintString, getCastTypeName, getColumnComment, getCreateSequenceStrings, getCurrentTimestampSQLFunctionName, getDefaultProperties, getDialect, getDialect, getDropForeignKeyString, getDropSequenceStrings, getForUpdateNowaitString, getForUpdateNowaitString, getForUpdateString, getForUpdateString, getFunctions, getHibernateTypeName, getHibernateTypeName, getIdentityColumnString, getIdentityInsertString, getIdentitySelectString, getKeywords, getLimitString, getLowercaseFunction, getMaxAliasLength, getNullColumnString, getResultSet, getSelectGUIDString, getTableComment, getTableTypeString, getTypeName, getTypeName, hasAlterTable, hasSelfReferentialForeignKeyBug, openQuote, performTemporaryTableDDLInIsolation, qualifyIndexName, quote, registerColumnType, registerColumnType, registerFunction, registerHibernateType, registerHibernateType, registerKeyword, registerResultSetOutParameter, supportsCascadeDelete, supportsColumnCheck, supportsIfExistsAfterTableName, supportsIfExistsBeforeTableName, supportsInsertSelectIdentity, supportsLimitOffset, supportsNotNullUnique, supportsParametersInInsertSelect, supportsTableCheck, supportsUnique, supportsUniqueConstraintInCreateAlterTable, supportsVariableLimit, toString, transformSelectString, useMaxForLimit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PostgreSQLDialect

public PostgreSQLDialect()
Method Detail

getAddColumnString

public String getAddColumnString()
Description copied from class: Dialect
The syntax used to add a column to a table (optional).

Overrides:
getAddColumnString in class Dialect

getSequenceNextValString

public String getSequenceNextValString(String sequenceName)
Description copied from class: Dialect
Generate the appropriate select statement to to retreive the next value of a sequence, if sequences are supported.

This should be a "stand alone" select statement.

Overrides:
getSequenceNextValString in class Dialect
Parameters:
sequenceName - the name of the sequence
Returns:
String The "nextval" select string.

getSelectSequenceNextValString

public String getSelectSequenceNextValString(String sequenceName)
Description copied from class: Dialect
Generate the select expression fragment that will retreive the next value of a sequence, if sequences are supported.

This differs from Dialect.getSequenceNextValString(String) in that this should return an expression usable within another select statement.

Overrides:
getSelectSequenceNextValString in class Dialect
Parameters:
sequenceName - the name of the sequence
Returns:
String

getCreateSequenceString

public String getCreateSequenceString(String sequenceName)
Description copied from class: Dialect
The syntax used to create a sequence, if sequences are supported.

Overrides:
getCreateSequenceString in class Dialect
Parameters:
sequenceName - the name of the sequence
Returns:
String

getDropSequenceString

public String getDropSequenceString(String sequenceName)
Description copied from class: Dialect
The syntax used to drop a sequence, if sequences are supported.

Overrides:
getDropSequenceString in class Dialect
Parameters:
sequenceName - the name of the sequence
Returns:
String

getCascadeConstraintsString

public String getCascadeConstraintsString()
Description copied from class: Dialect
Completely optional cascading drop clause

Overrides:
getCascadeConstraintsString in class Dialect
Returns:
String

dropConstraints

public boolean dropConstraints()
Description copied from class: Dialect
Do we need to drop constraints before dropping tables in this dialect?

Overrides:
dropConstraints in class Dialect
Returns:
boolean

supportsSequences

public boolean supportsSequences()
Description copied from class: Dialect
Does this dialect support sequences?

Overrides:
supportsSequences in class Dialect
Returns:
boolean

getQuerySequencesString

public String getQuerySequencesString()
Description copied from class: Dialect
A query used to find all sequences

Overrides:
getQuerySequencesString in class Dialect
See Also:
SchemaUpdate

supportsLimit

public boolean supportsLimit()
Description copied from class: Dialect
Does this Dialect have some kind of LIMIT syntax?

Overrides:
supportsLimit in class Dialect

getLimitString

public String getLimitString(String sql,
                             boolean hasOffset)
Description copied from class: Dialect
Add a LIMIT clause to the given SQL SELECT

Overrides:
getLimitString in class Dialect
Returns:
the modified SQL

bindLimitParametersInReverseOrder

public boolean bindLimitParametersInReverseOrder()
Description copied from class: Dialect
Does the LIMIT clause specify arguments in the "reverse" order limit, offset instead of offset, limit?

Overrides:
bindLimitParametersInReverseOrder in class Dialect
Returns:
true if the correct order is limit, offset

supportsIdentityColumns

public boolean supportsIdentityColumns()
Description copied from class: Dialect
Does this dialect support identity column key generation?

Overrides:
supportsIdentityColumns in class Dialect
Returns:
boolean

getForUpdateString

public String getForUpdateString(String aliases)
Description copied from class: Dialect
Does this dialect support the FOR UPDATE OF syntax?

Overrides:
getForUpdateString in class Dialect
Returns:
boolean

getIdentitySelectString

public String getIdentitySelectString(String table,
                                      String column,
                                      int type)
Description copied from class: Dialect
The syntax that returns the identity value of the last insert, if identity column key generation is supported.

Overrides:
getIdentitySelectString in class Dialect
Parameters:
type - TODO

getIdentityColumnString

public String getIdentityColumnString(int type)
Description copied from class: Dialect
The keyword used to specify an identity column, if identity column key generation is supported.

Overrides:
getIdentityColumnString in class Dialect
Parameters:
type - the SQL column type, as defined by java.sql.Types

hasDataTypeInIdentityColumn

public boolean hasDataTypeInIdentityColumn()
Description copied from class: Dialect
Whether this dialect have an Identity clause added to the data type or a completely seperate identity data type

Overrides:
hasDataTypeInIdentityColumn in class Dialect
Returns:
boolean

getNoColumnsInsertString

public String getNoColumnsInsertString()
Description copied from class: Dialect
The keyword used to insert a row without specifying any column values. This is not possible on some databases.

Overrides:
getNoColumnsInsertString in class Dialect

getNativeIdentifierGeneratorClass

public Class getNativeIdentifierGeneratorClass()
Overrides:
getNativeIdentifierGeneratorClass in class Dialect

supportsOuterJoinForUpdate

public boolean supportsOuterJoinForUpdate()
Overrides:
supportsOuterJoinForUpdate in class Dialect

useInputStreamToInsertBlob

public boolean useInputStreamToInsertBlob()
Overrides:
useInputStreamToInsertBlob in class Dialect

supportsUnionAll

public boolean supportsUnionAll()
Overrides:
supportsUnionAll in class Dialect

getSelectClauseNullString

public String getSelectClauseNullString(int sqlType)
Workaround for postgres bug #1453

Overrides:
getSelectClauseNullString in class Dialect

supportsCommentOn

public boolean supportsCommentOn()
Overrides:
supportsCommentOn in class Dialect

supportsTemporaryTables

public boolean supportsTemporaryTables()
Overrides:
supportsTemporaryTables in class Dialect

getCreateTemporaryTableString

public String getCreateTemporaryTableString()
Overrides:
getCreateTemporaryTableString in class Dialect

getCreateTemporaryTablePostfix

public String getCreateTemporaryTablePostfix()
Overrides:
getCreateTemporaryTablePostfix in class Dialect

supportsCurrentTimestampSelection

public boolean supportsCurrentTimestampSelection()
Overrides:
supportsCurrentTimestampSelection in class Dialect

isCurrentTimestampSelectStringCallable

public boolean isCurrentTimestampSelectStringCallable()
Overrides:
isCurrentTimestampSelectStringCallable in class Dialect

getCurrentTimestampSelectString

public String getCurrentTimestampSelectString()
Overrides:
getCurrentTimestampSelectString in class Dialect

toBooleanValueString

public String toBooleanValueString(boolean bool)
Description copied from class: Dialect
The SQL value that the JDBC driver maps boolean values to

Overrides:
toBooleanValueString in class Dialect

getViolatedConstraintNameExtracter

public ViolatedConstraintNameExtracter getViolatedConstraintNameExtracter()
Overrides:
getViolatedConstraintNameExtracter in class Dialect