java.lang.Object | ||
↳ | org.hibernate.dialect.Dialect | |
↳ | org.hibernate.dialect.PostgreSQLDialect |
Known Direct Subclasses |
An SQL dialect for Postgres
For discussion of BLOB support in Postgres, as of 8.4, have a peek at http://jdbc.postgresql.org/documentation/84/binary-data.html. For the effects in regards to Hibernate see http://in.relation.to/15492.lace
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.hibernate.dialect.Dialect
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit.
| |||||||||||
Do we need to drop constraints before dropping tables in this dialect?
| |||||||||||
The syntax used to add a column to a table (optional).
| |||||||||||
Completely optional cascading drop clause
| |||||||||||
Typically dialects which support sequences can create a sequence
with a single command.
| |||||||||||
Get any fragments needing to be postfixed to the command for
temporary table creation.
| |||||||||||
Command used to create a temporary table.
| |||||||||||
Retrieve the command used to retrieve the current timestamp from the
database.
| |||||||||||
Typically dialects which support sequences can drop a sequence
with a single command.
| |||||||||||
Get the string to append to SELECT statements to acquire locks
for this dialect.
| |||||||||||
Get the FOR UPDATE OF column_list fragment appropriate for this
dialect given the aliases of the columns to be write locked.
| |||||||||||
The syntax used during DDL to define a column as being an IDENTITY of
a particular type.
| |||||||||||
Get the select command to use to retrieve the last generated IDENTITY
value for a particular table
| |||||||||||
Apply s limit clause to the query.
| |||||||||||
The class (which implements
IdentifierGenerator )
which acts as this dialects native generation strategy. | |||||||||||
The fragment used to insert a row without specifying any column values.
| |||||||||||
Get the select command used retrieve the names of all sequences.
| |||||||||||
Get the string to append to SELECT statements to acquire WRITE locks
for this dialect.
| |||||||||||
Given a callable statement previously processed by
registerResultSetOutParameter(CallableStatement, int) ,
extract the ResultSet from the OUT parameter. | |||||||||||
Workaround for postgres bug #1453
| |||||||||||
Generate the select expression fragment that will retrieve the next
value of a sequence as part of another (typically DML) statement.
| |||||||||||
Generate the appropriate select statement to to retrieve the next value
of a sequence.
| |||||||||||
Get the string to append to SELECT statements to acquire WRITE locks
for this dialect.
| |||||||||||
Whether this dialect have an Identity clause added to the data type or a
completely separate identity data type
| |||||||||||
Should the value returned by
getCurrentTimestampSelectString()
be treated as callable. | |||||||||||
Registers an OUT parameter which will be returning a
ResultSet . | |||||||||||
Does this dialect support a way to retrieve the database's current
timestamp value?
| |||||||||||
Does this dialect support empty IN lists?
For example, is [where XYZ in ()] a supported construct?
| |||||||||||
Expected LOB usage pattern is such that I can perform an insert
via prepared statement with a parameter binding for a LOB value
without crazy casting to JDBC driver implementation-specific classes...
| |||||||||||
Does this dialect support identity column key generation?
| |||||||||||
Does this dialect support some form of limiting query results
via a SQL clause?
| |||||||||||
Does the dialect support propagating changes to LOB
values back to the database? Talking about mutating the
internal value of the locator as opposed to supplying a new
locator instance...
| |||||||||||
Does this dialect support FOR UPDATE in conjunction with
outer joined rows?
| |||||||||||
Does this dialect support "pooled" sequences.
| |||||||||||
Does this dialect support sequences?
| |||||||||||
Does this dialect support temporary tables?
| |||||||||||
Does this dialect support `count(distinct a,b)`?
| |||||||||||
Is it supported to materialize a LOB locator outside the transaction in
which it was created?
Again, part of the trickiness here is the fact that this is largely
driver dependent.
| |||||||||||
Does this dialect support UNION ALL, which is generally a faster
variant of UNION?
| |||||||||||
The SQL literal value to which this database maps boolean values.
| |||||||||||
Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Overloaded form of
getCreateSequenceString(String) , additionally
taking the initial value and increment size to be applied to the sequence
definition. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.hibernate.dialect.Dialect
| |||||||||||
From class
java.lang.Object
|
ANSI SQL defines the LIMIT clause to be in the form LIMIT offset, limit. Does this dialect require us to bind the parameters in reverse order?
Do we need to drop constraints before dropping tables in this dialect?
The syntax used to add a column to a table (optional).
Completely optional cascading drop clause
Typically dialects which support sequences can create a sequence
with a single command. This is convenience form of
getCreateSequenceStrings(String)
to help facilitate that.
getCreateSequenceStrings(String)
.sequenceName | The name of the sequence |
---|
Get any fragments needing to be postfixed to the command for temporary table creation.
Command used to create a temporary table.
Retrieve the command used to retrieve the current timestamp from the database.
Typically dialects which support sequences can drop a sequence
with a single command. This is convenience form of
getDropSequenceStrings(String)
to help facilitate that.
getDropSequenceStrings(String)
.sequenceName | The name of the sequence |
---|
Get the string to append to SELECT statements to acquire locks for this dialect.
Get the FOR UPDATE OF column_list fragment appropriate for this dialect given the aliases of the columns to be write locked.
aliases | The columns to be write locked. |
---|
The syntax used during DDL to define a column as being an IDENTITY of a particular type.
type | The java.sql.Types type code. |
---|
Get the select command to use to retrieve the last generated IDENTITY value for a particular table
table | The table into which the insert was done |
---|---|
column | The PK column. |
type | The java.sql.Types type code. |
Apply s limit clause to the query.
Typically dialects utilizevariable
limit clauses when they support limits. Thus, when building the
select command we do not actually need to know the limit or the offest
since we will just be using placeholders.
Here we do still pass along whether or not an offset was specified
so that dialects not supporting offsets can generate proper exceptions.
In general, dialects will override one or the other of this method and
getLimitString(String, int, int)
.sql | The query to which to apply the limit. |
---|---|
hasOffset | Is the query requesting an offset? |
The class (which implements IdentifierGenerator
)
which acts as this dialects native generation strategy.
The fragment used to insert a row without specifying any column values. This is not possible on some databases.
Get the select command used retrieve the names of all sequences.
Get the string to append to SELECT statements to acquire WRITE locks for this dialect. Location of the of the returned string is treated the same as getForUpdateString.
timeout | in milliseconds, -1 for indefinite wait and 0 for no wait. |
---|
Given a callable statement previously processed by registerResultSetOutParameter(CallableStatement, int)
,
extract the ResultSet
from the OUT parameter.
ps | The callable statement. |
---|
SQLException |
---|
Workaround for postgres bug #1453
sqlType | The java.sql.Types type code. |
---|
Generate the select expression fragment that will retrieve the next value of a sequence as part of another (typically DML) statement.
This differs fromgetSequenceNextValString(String)
in that this
should return an expression usable within another statement.sequenceName | the name of the sequence |
---|
Generate the appropriate select statement to to retrieve the next value of a sequence.
This should be a "stand alone" select statement.sequenceName | the name of the sequence |
---|
Get the string to append to SELECT statements to acquire WRITE locks for this dialect. Location of the of the returned string is treated the same as getForUpdateString.
timeout | in milliseconds, -1 for indefinite wait and 0 for no wait. |
---|
Whether this dialect have an Identity clause added to the data type or a completely separate identity data type
Should the value returned by getCurrentTimestampSelectString()
be treated as callable. Typically this indicates that JDBC escape
syntax is being used...
getCurrentTimestampSelectString()
return
is callable; false otherwise.
Registers an OUT parameter which will be returning a
ResultSet
. How this is accomplished varies greatly
from DB to DB, hence its inclusion (along with getResultSet(CallableStatement)
) here.
statement | The callable statement. |
---|---|
col | The bind position at which to register the OUT param. |
SQLException |
---|
Does this dialect support a way to retrieve the database's current timestamp value?
Does this dialect support empty IN lists?
For example, is [where XYZ in ()] a supported construct?Expected LOB usage pattern is such that I can perform an insert via prepared statement with a parameter binding for a LOB value without crazy casting to JDBC driver implementation-specific classes...
Part of the trickiness here is the fact that this is largely driver dependent. For example, Oracle (which is notoriously bad with LOB support in their drivers historically) actually does a pretty good job with LOB support as of the 10.2.x versions of their drivers...Does this dialect support identity column key generation?
Does this dialect support some form of limiting query results via a SQL clause?
Does the dialect support propagating changes to LOB values back to the database? Talking about mutating the internal value of the locator as opposed to supplying a new locator instance...
For BLOBs, the internal value might be changed by:setBinaryStream(long)
,
setBytes(long, byte[])
,
setBytes(long, byte[], int, int)
,
or truncate(long)
.
For CLOBs, the internal value might be changed by:
setAsciiStream(long)
,
setCharacterStream(long)
,
setString(long, String)
,
setString(long, String, int, int)
,
or truncate(long)
.
NOTE : I do not know the correct answer currently for
databases which (1) are not part of the cruise control process
or (2) do not supportsExpectedLobUsagePattern()
.Does this dialect support FOR UPDATE in conjunction with outer joined rows?
Does this dialect support "pooled" sequences. Not aware of a better name for this. Essentially can we specify the initial and increment values?
Does this dialect support sequences?
Does this dialect support temporary tables?
Does this dialect support `count(distinct a,b)`?
Is it supported to materialize a LOB locator outside the transaction in which it was created?
Again, part of the trickiness here is the fact that this is largely driver dependent. NOTE: all database I have tested whichsupportsExpectedLobUsagePattern()
also support the ability to materialize a LOB outside the owning transaction...Does this dialect support UNION ALL, which is generally a faster variant of UNION?
The SQL literal value to which this database maps boolean values.
bool | The boolean value |
---|
Should LOBs (both BLOB and CLOB) be bound using stream operations (i.e.
setBinaryStream(int, InputStream)
).
Overloaded form of getCreateSequenceString(String)
, additionally
taking the initial value and increment size to be applied to the sequence
definition.
getCreateSequenceString(String)
with the string: " start with {initialValue} increment by {incrementSize}" where
{initialValue} and {incrementSize} are replacement placeholders. Generally
dialects should only need to override this method if different key phrases
are used to apply the allocation information.sequenceName | The name of the sequence |
---|---|
initialValue | The initial value to apply to 'create sequence' statement |
incrementSize | The increment value to apply to 'create sequence' statement |