public class PostgresDbEngine extends AbstractDbEngine implements DbEngine
Constructor and Description |
---|
PostgresDbEngine()
Create PostgresDbEngine.
|
Modifier and Type | Method and Description |
---|---|
boolean |
analyzeAfterBatchOperation()
Return true.
|
private void |
appendList(java.lang.StringBuilder sb,
java.util.Collection<java.lang.String> items) |
boolean |
caseInsensitiveComparison()
Returns FALSE.
|
boolean |
checkForInvalidNumberOperation()
Returns TRUE.
|
java.lang.String |
getAnalyzeTableSql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Generate
ANALYZE <schema>. |
java.lang.String |
getApproximateRowCountSql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Get an SQL statement that returns an approximate count for the number
of rows in the given table.
|
java.lang.String |
getCreateForeignKeySql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String name,
java.util.Set<java.lang.String> columns,
java.lang.String refTable,
java.util.Set<java.lang.String> refColumns)
Generate
alter table schema.table add constraint name
foreign key (columns) references refTable (refColumns) |
java.lang.String |
getCreateIndexSql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String name,
java.util.Set<java.lang.String> columns,
boolean unique)
Generate
alter table <schema>. |
java.lang.String |
getCreatePartialIndexSql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String name,
java.util.Set<java.lang.String> columns,
java.lang.String condition)
Creates a partial index which is the same as a regular index + 'WHERE [condition]';
|
java.lang.String |
getCreatePrimaryKeySql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String name,
java.util.Set<java.lang.String> columns)
Generate
alter table schema.table add constraint name
primary key (columns) . |
java.lang.String |
getCreateSchemaSql(java.lang.String catalog,
java.lang.String schema)
Generate
create schema <schema> . |
java.lang.String |
getDropForeignKeySql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String name)
Generate
alter table <schema>. |
java.lang.String |
getDropIndexSql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String name,
boolean unique)
Generate
alter table <schema>. |
java.lang.String |
getDropPrimaryKey(java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String name)
Generate
alter table schema.table drop constraint name |
java.lang.String |
getInsertAutoIncrementSql(PersistentClass pc)
Return a SQL fragment that can be used in an INSERT INTO statement
to generate an ID for new rows.
|
java.lang.String |
getOptimizeTableSql(java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Generate
VACUUM FULL <schema>. |
java.lang.String |
rlike(java.lang.String value,
java.lang.String regexp)
Return
<value> ~ <regexp> . |
boolean |
selectOrderByColumnsIfDistinct()
Returns TRUE.
|
boolean |
supportColumnAliasInGroupBy()
Returns TRUE.
|
boolean |
supportColumnAliasInHaving()
Returns FALSE.
|
boolean |
supportColumnAliasInOrderBy()
Returns TRUE.
|
boolean |
supportsColumnAliasInWhere()
Returns FALSE.
|
boolean |
useSavePointToContinueTransactionFromSqlFailure()
If the underlying database need to create a savepoint before executing
an SQL statement that results in an error in order to be able to
continue using the same transaction for other SQL queries.
|
boolean |
useThetaJoin()
Always false.
|
abs, castToDate, dropForeignKeysUsedInIndex, exp, getCaseSensitiveVarchar, getCatalogName, getMaxParametersInQuery, getQuotedName, getSchemaName, inspectSchemaGenerationSQL, isValidColumnName, isValidName, isValidTableName, ln, makeSafeCreateTable, power
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
abs, castToDate, dropForeignKeysUsedInIndex, exp, getCaseSensitiveVarchar, getCatalogName, getMaxParametersInQuery, getQuotedName, getSchemaName, inspectSchemaGenerationSQL, isValidColumnName, isValidTableName, ln, makeSafeCreateTable, power
public boolean useThetaJoin()
useThetaJoin
in interface DbEngine
useThetaJoin
in class AbstractDbEngine
public java.lang.String getCreateSchemaSql(java.lang.String catalog, java.lang.String schema)
create schema <schema>
.
The catalog parameter is not supported.getCreateSchemaSql
in interface DbEngine
public java.lang.String getCreateIndexSql(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String name, java.util.Set<java.lang.String> columns, boolean unique)
alter table <schema>.<table> add constraint <name>
unique (<columns>)
for a unique index,
create index <name> on <schema>.<table> (<columns>)
for other indexes.
The catalog parameter is not supported.getCreateIndexSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the index to be createdcolumns
- The name of the columns in the indexunique
- If the index must contain unique values or notpublic java.lang.String getCreatePartialIndexSql(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String name, java.util.Set<java.lang.String> columns, java.lang.String condition)
getCreatePartialIndexSql
in interface DbEngine
getCreatePartialIndexSql
in class AbstractDbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the index to be createdcolumns
- The name of the columns in the indexcondition
- The condition that specifies which rows to include in the index.
Use '[' and ']' as placeholders for the open/close quote of the current dialect.public java.lang.String getDropIndexSql(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String name, boolean unique)
alter table <schema>.<table> drop constraint <name>
for unique indexes, drop index <schema>.<name>
for other indexes.
The catalog parameter is not supported.getDropIndexSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the indexunique
- If the index contains unique values or notpublic java.lang.String getCreateForeignKeySql(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String name, java.util.Set<java.lang.String> columns, java.lang.String refTable, java.util.Set<java.lang.String> refColumns)
alter table schema.table add constraint name
foreign key (columns) references refTable (refColumns)
getCreateForeignKeySql
in interface DbEngine
catalog
- The name of the catalog (database) where the tables are
located, or null if it is located in the current catalogschema
- The name of the schema where the tables are located, or
null if is located in the current schematable
- The name of the foreign key tablename
- The name of the foreign keycolumns
- The columns that make up the foreign keyrefTable
- The table that is referenced by the foreign keyrefColumns
- The columns that are referenced by the foreign keypublic java.lang.String getDropForeignKeySql(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String name)
alter table <schema>.<table> DROP CONSTRAINT <name>
getDropForeignKeySql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the foreign keypublic java.lang.String getCreatePrimaryKeySql(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String name, java.util.Set<java.lang.String> columns)
alter table schema.table add constraint name
primary key (columns)
.getCreatePrimaryKeySql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the primary keycolumns
- The name of the columns in the primary keypublic java.lang.String getDropPrimaryKey(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String name)
alter table schema.table drop constraint name
getDropPrimaryKey
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the primary keypublic java.lang.String getInsertAutoIncrementSql(PersistentClass pc)
DbEngine
getInsertAutoIncrementSql
in interface DbEngine
pc
- The persistent classpublic boolean analyzeAfterBatchOperation()
analyzeAfterBatchOperation
in interface DbEngine
public java.lang.String getOptimizeTableSql(java.lang.String catalog, java.lang.String schema, java.lang.String table)
VACUUM FULL <schema>.<table>
.
The catalog parameter is not supported.getOptimizeTableSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the table to optimizeDbEngine.getAnalyzeTableSql(String, String, String)
public java.lang.String getAnalyzeTableSql(java.lang.String catalog, java.lang.String schema, java.lang.String table)
ANALYZE <schema>.<table>
.
The catalog parameter is not supported.getAnalyzeTableSql
in interface DbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the table to analyzeDbEngine.getOptimizeTableSql(String, String, String)
public boolean caseInsensitiveComparison()
caseInsensitiveComparison
in interface DbEngine
public boolean supportsColumnAliasInWhere()
supportsColumnAliasInWhere
in interface DbEngine
supportsColumnAliasInWhere
in class AbstractDbEngine
public boolean supportColumnAliasInOrderBy()
supportColumnAliasInOrderBy
in interface DbEngine
supportColumnAliasInOrderBy
in class AbstractDbEngine
public boolean supportColumnAliasInGroupBy()
supportColumnAliasInGroupBy
in interface DbEngine
supportColumnAliasInGroupBy
in class AbstractDbEngine
public boolean supportColumnAliasInHaving()
supportColumnAliasInHaving
in interface DbEngine
supportColumnAliasInHaving
in class AbstractDbEngine
public boolean checkForInvalidNumberOperation()
checkForInvalidNumberOperation
in interface DbEngine
checkForInvalidNumberOperation
in class AbstractDbEngine
public boolean selectOrderByColumnsIfDistinct()
selectOrderByColumnsIfDistinct
in interface DbEngine
selectOrderByColumnsIfDistinct
in class AbstractDbEngine
public java.lang.String rlike(java.lang.String value, java.lang.String regexp)
<value> ~ <regexp>
.rlike
in interface DbEngine
rlike
in class AbstractDbEngine
value
- The left valueregexp
- The regular expression as a stringpublic boolean useSavePointToContinueTransactionFromSqlFailure()
DbEngine
useSavePointToContinueTransactionFromSqlFailure
in interface DbEngine
useSavePointToContinueTransactionFromSqlFailure
in class AbstractDbEngine
public java.lang.String getApproximateRowCountSql(java.lang.String catalog, java.lang.String schema, java.lang.String table)
DbEngine
getApproximateRowCountSql
in interface DbEngine
getApproximateRowCountSql
in class AbstractDbEngine
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tableprivate void appendList(java.lang.StringBuilder sb, java.util.Collection<java.lang.String> items)