net.sf.hajdbc.dialect
Class PostgreSQLDialect

java.lang.Object
  extended by net.sf.hajdbc.dialect.StandardDialect
      extended by net.sf.hajdbc.dialect.PostgreSQLDialect
All Implemented Interfaces:
Dialect

public class PostgreSQLDialect
extends StandardDialect

Dialect for PostgreSQL.

Since:
1.1
Author:
Paul Ferraro

Constructor Summary
PostgreSQLDialect()
           
 
Method Summary
protected  String alterIdentityColumnFormat()
           
protected  String currentTimestampPattern()
           
 int getColumnType(ColumnProperties properties)
          PostgreSQL uses the native type OID to identify BLOBs.
 List<String> getDefaultSchemas(DatabaseMetaData metaData)
          PostgreSQL uses a schema search path to locate unqualified table names.
 Pattern getIdentifierPattern(DatabaseMetaData metaData)
          Versions >=8.1 of the PostgreSQL JDBC driver return incorrect values for DatabaseMetaData.getExtraNameCharacters().
 boolean isIdentity(ColumnProperties properties)
          Indicates whether or not the specified column is an identity column.
protected  String nextSequenceValueFormat()
           
protected  String randomPattern()
           
protected  String selectForUpdatePattern()
          Recognizes FOR SHARE and FOR UPDATE.
protected  String sequencePattern()
           
protected  String truncateTableFormat()
           
 
Methods inherited from class net.sf.hajdbc.dialect.StandardDialect
alterSequenceFormat, createForeignKeyConstraintFormat, createUniqueConstraintFormat, currentDatePattern, currentTimePattern, currentTimestampFunction, dateLiteralFormat, dropConstraintFormat, dropForeignKeyConstraintFormat, dropUniqueConstraintFormat, dummyTable, evaluateCurrentDate, evaluateCurrentTime, evaluateCurrentTimestamp, evaluateRand, executeFunction, executeFunctionFormat, executeFunctionSQL, executeQuery, getAlterIdentityColumnSQL, getAlterSequenceSQL, getCreateForeignKeyConstraintSQL, getCreateUniqueConstraintSQL, getDropForeignKeyConstraintSQL, getDropUniqueConstraintSQL, getNextSequenceValueSQL, getSequences, getSimpleSQL, getTruncateTableSQL, insertIntoTablePattern, isSelectForUpdate, parse, parseInsertTable, parseSequence, sequenceTableType, timeLiteralFormat, timestampLiteralFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostgreSQLDialect

public PostgreSQLDialect()
Method Detail

getDefaultSchemas

public List<String> getDefaultSchemas(DatabaseMetaData metaData)
                               throws SQLException
PostgreSQL uses a schema search path to locate unqualified table names. The default search path is [$user,public], where $user is the current user.

Specified by:
getDefaultSchemas in interface Dialect
Overrides:
getDefaultSchemas in class StandardDialect
Returns:
a list of schema names
Throws:
SQLException
See Also:
StandardDialect.getDefaultSchemas(java.sql.DatabaseMetaData)

getColumnType

public int getColumnType(ColumnProperties properties)
PostgreSQL uses the native type OID to identify BLOBs. However the JDBC driver incomprehensibly maps OIDs to INTEGERs. The PostgreSQL JDBC folks claim this intentional.

Specified by:
getColumnType in interface Dialect
Overrides:
getColumnType in class StandardDialect
Parameters:
properties - table column meta data
Returns:
the JDBC data type of this column
See Also:
StandardDialect.getColumnType(net.sf.hajdbc.ColumnProperties)

isIdentity

public boolean isIdentity(ColumnProperties properties)
Description copied from interface: Dialect
Indicates whether or not the specified column is an identity column.

Specified by:
isIdentity in interface Dialect
Overrides:
isIdentity in class StandardDialect
Parameters:
properties - a table column
Returns:
true, if this column is an identity column, false otherwise
See Also:
StandardDialect.isIdentity(net.sf.hajdbc.ColumnProperties)

getIdentifierPattern

public Pattern getIdentifierPattern(DatabaseMetaData metaData)
                             throws SQLException
Versions >=8.1 of the PostgreSQL JDBC driver return incorrect values for DatabaseMetaData.getExtraNameCharacters().

Specified by:
getIdentifierPattern in interface Dialect
Overrides:
getIdentifierPattern in class StandardDialect
Returns:
a regular expression pattern
Throws:
SQLException
See Also:
StandardDialect.getIdentifierPattern(java.sql.DatabaseMetaData)

truncateTableFormat

protected String truncateTableFormat()
Overrides:
truncateTableFormat in class StandardDialect
See Also:
StandardDialect.truncateTableFormat()

sequencePattern

protected String sequencePattern()
Overrides:
sequencePattern in class StandardDialect
See Also:
StandardDialect.sequencePattern()

nextSequenceValueFormat

protected String nextSequenceValueFormat()
Overrides:
nextSequenceValueFormat in class StandardDialect
See Also:
StandardDialect.nextSequenceValueFormat()

alterIdentityColumnFormat

protected String alterIdentityColumnFormat()
Overrides:
alterIdentityColumnFormat in class StandardDialect
See Also:
StandardDialect.alterIdentityColumnFormat()

currentTimestampPattern

protected String currentTimestampPattern()
Overrides:
currentTimestampPattern in class StandardDialect
See Also:
StandardDialect.currentTimestampPattern()

randomPattern

protected String randomPattern()
Overrides:
randomPattern in class StandardDialect
See Also:
StandardDialect.randomPattern()

selectForUpdatePattern

protected String selectForUpdatePattern()
Recognizes FOR SHARE and FOR UPDATE.

Overrides:
selectForUpdatePattern in class StandardDialect
See Also:
StandardDialect.selectForUpdatePattern()