Purpose: Provides Postgres specific behavior.
Responsibilities:
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| LIMIT | back to summary |
|---|---|
| private static final String LIMIT | |
| OFFSET | back to summary |
|---|---|
| private static final String OFFSET | |
| PostgreSQLPlatform | back to summary |
|---|---|
| public PostgreSQLPlatform() | |
| appendBoolean | back to summary |
|---|---|
| protected void appendBoolean(Boolean bool, Writer writer) throws IOException Overrides org. Appends a Boolean value. Refer to : http://www.postgresql.org/docs/8.0/static/datatype-boolean.html In PostgreSQL the following are the values that are value for a boolean field Valid literal values for the "true" state are: TRUE, 't', 'true', 'y', 'yes', '1' Valid literal values for the false" state are : FALSE, 'f', 'false', 'n', 'no', '0' To be consistent with the other data platforms we are using the values '1' and '0' for true and false states of a boolean field.
| |
| buildCallWithReturning | back to summary |
|---|---|
| public DatabaseCall buildCallWithReturning(SQLCall sqlCall, Vector<DatabaseField> returnFields) Overrides org. INTERNAL: Uses the returning clause on Postgres.
| |
| buildFieldTypes | back to summary |
|---|---|
| protected Hashtable Overrides org. Doc from org. Return the mapping of class types to database types for the schema framework.
| |
| buildProcedureCallString | back to summary |
|---|---|
| public String buildProcedureCallString(StoredProcedureCall call, AbstractSession session, AbstractRecord row) Overrides org. INTERNAL: Used for sp calls. PostGreSQL uses a different method for executing StoredProcedures than other platforms.
| |
| buildSelectQueryForIdentity | back to summary |
|---|---|
| public ValueReadQuery buildSelectQueryForIdentity() Overrides org. INTERNAL: Returns query used to read back the value generated by Identity. This method is called when identity NativeSequence is connected, the returned query used until the sequence is disconnected. If the platform supportsIdentity then (at least) one of buildSelectQueryForIdentity methods should return non-null query.
| |
| buildSelectQueryForSequenceObject | back to summary |
|---|---|
| public ValueReadQuery buildSelectQueryForSequenceObject(String qualifiedSeqName, Integer size) Overrides org. INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence). This method is called when sequence object NativeSequence is connected, the returned query used until the sequence is disconnected. If the platform supportsSequenceObjects then (at least) one of buildSelectQueryForSequenceObject methods should return non-null query.
| |
| canBuildCallWithReturning | back to summary |
|---|---|
| public boolean canBuildCallWithReturning() Overrides org. INTERNAL: Postgres has a returning clause.
| |
| computeMaxRowsForSQL | back to summary |
|---|---|
| public int computeMaxRowsForSQL(int firstResultIndex, int maxResults) Overrides org. INTERNAL: Use the JDBC maxResults and firstResultIndex setting to compute a value to use when limiting the results of a query in SQL. These limits tend to be used in two ways. 1. MaxRows is the index of the last row to be returned (like JDBC maxResults) 2. MaxRows is the number of rows to be returned PostGreSQL uses case #2 and therefore the maxResults has to be altered based on the firstResultIndex
| |
| getAssignmentString | back to summary |
|---|---|
| public String getAssignmentString() Overrides org. INTERNAL Used for stored function calls.
| |
| getCreateTempTableSqlPrefix | back to summary |
|---|---|
| protected String getCreateTempTableSqlPrefix() Overrides org. INTERNAL:
| |
| getCreateTempTableSqlSuffix | back to summary |
|---|---|
| protected String getCreateTempTableSqlSuffix() Overrides org. INTERNAL:
| |
| getDropCascadeString | back to summary |
|---|---|
| public String getDropCascadeString() Overrides org. Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.
| |
| getInOutputProcedureToken | back to summary |
|---|---|
| public String getInOutputProcedureToken() Overrides org. This method is used to print the output parameter token when stored procedures are called
| |
| getJDBCType | back to summary |
|---|---|
| public int getJDBCType(Class<?> javaType) Overrides org. Return the JDBC type for the Java type. For some reason PostgreSQL does not seem to like the JDBC Blob type (PostgreSQL 8.2).
| |
| getMaxFieldNameSize | back to summary |
|---|---|
| public int getMaxFieldNameSize() Overrides org. INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.
| |
| getProcedureBeginString | back to summary |
|---|---|
| public String getProcedureBeginString() Overrides org. INTERNAL: Used for sp calls.
| |
| getProcedureEndString | back to summary |
|---|---|
| public String getProcedureEndString() Overrides org. INTERNAL: Used for sp calls.
| |
| getTimestampQuery | back to summary |
|---|---|
| public ValueReadQuery getTimestampQuery() Overrides org. Implements org. INTERNAL: This method returns the query to select the timestamp from the server for Postgres.
| |
| initializePlatformOperators | back to summary |
|---|---|
| protected void initializePlatformOperators() Overrides org. INTERNAL: Initialize any platform-specific operators
| |
| isAlterSequenceObjectSupported | back to summary |
|---|---|
| public boolean isAlterSequenceObjectSupported() Overrides org. INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.
| |
| isJDBCExecuteCompliant | back to summary |
|---|---|
| public boolean isJDBCExecuteCompliant() Overrides org. Calling a stored procedure query on PostgreSQL with no output parameters always returns true from an execute call regardless if a result set is returned or not. This flag will help avoid throwing a JPA mandated exception on an executeUpdate call (which calls jdbc execute and checks the return value to ensure no results sets are returned (true))
| |
| isPostgreSQL | back to summary |
|---|---|
| public boolean isPostgreSQL() Overrides org. Implements org. INTERNAL: Answers whether platform is Postgres.
| |
| operatorLocate | back to summary |
|---|---|
| protected ExpressionOperator operatorLocate() INTERNAL: Override the default locate operator. | |
| operatorLocate2 | back to summary |
|---|---|
| protected ExpressionOperator operatorLocate2() INTERNAL: Override the default locate operator. | |
| pgsqlRoundOperator | back to summary |
|---|---|
| private static ExpressionOperator pgsqlRoundOperator() | |
| printFieldIdentityClause | back to summary |
|---|---|
| public void printFieldIdentityClause(Writer writer) throws ValidationException Overrides org. INTERNAL: Append the receiver's field 'identity' constraint clause to a writer.
| |
| printFieldTypeSize | back to summary |
|---|---|
| public void printFieldTypeSize(Writer writer, FieldDefinition field, FieldTypeDefinition fieldType, boolean shouldPrintFieldIdentityClause) throws IOException Overrides org.
| |
| printFieldUnique | back to summary |
|---|---|
| public void printFieldUnique(Writer writer, boolean shouldPrintFieldIdentityClause) throws IOException Overrides org.
| |
| printSQLSelectStatement | back to summary |
|---|---|
| public void printSQLSelectStatement(DatabaseCall call, ExpressionSQLPrinter printer, SQLSelectStatement statement) Overrides org. Print the pagination SQL using Postgres syntax " LIMIT <max> OFFSET <first>".
| |
| regexpOperator | back to summary |
|---|---|
| public static ExpressionOperator regexpOperator() INTERNAL: Create the ~ operator. REGEXP allows for comparison through regular expression. | |
| setNullFromDatabaseField | back to summary |
|---|---|
| protected void setNullFromDatabaseField(DatabaseField databaseField, PreparedStatement statement, int index) throws SQLException Overrides org.
| |
| setParameterValueInDatabaseCall | back to summary |
|---|---|
| public void setParameterValueInDatabaseCall(final Object parameter, final PreparedStatement statement, final int index, final AbstractSession session) throws SQLException Overrides org. INTERNAL Set the parameter in the JDBC statement at the given index in case it is a UUID value.
| |
| setParameterValueInDatabaseCall | back to summary |
|---|---|
| public void setParameterValueInDatabaseCall(Object parameter, CallableStatement statement, String name, AbstractSession session) throws SQLException Overrides org. INTERNAL Set the parameter in the JDBC statement at the given index in case it is a UUID value.
| |
| shouldPrintAliasForUpdate | back to summary |
|---|---|
| public boolean shouldPrintAliasForUpdate() Overrides org. INTERNAL: Indicates whether locking OF clause should print alias for field. Example: on Oracle platform (method returns false): SELECT ADDRESS_ID, ... FROM ADDRESS T1 WHERE (T1.ADDRESS_ID = ?) FOR UPDATE OF T1.ADDRESS_ID on Postgres platform (method returns true): SELECT ADDRESS_ID, ... FROM ADDRESS T1 WHERE (T1.ADDRESS_ID = ?) FOR UPDATE OF T1
| |
| shouldPrintOutputTokenAtStart | back to summary |
|---|---|
| public boolean shouldPrintOutputTokenAtStart() Overrides org. This is required in the construction of the stored procedures with output parameters
| |
| shouldUseJDBCOuterJoinSyntax | back to summary |
|---|---|
| public boolean shouldUseJDBCOuterJoinSyntax() Overrides org. JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.
| |
| supportsIdentity | back to summary |
|---|---|
| public boolean supportsIdentity() Overrides org. INTERNAL: Indicates whether the platform supports identity.
| |
| supportsLocalTempTables | back to summary |
|---|---|
| public boolean supportsLocalTempTables() Overrides org. INTERNAL:
| |
| supportsSequenceObjects | back to summary |
|---|---|
| public boolean supportsSequenceObjects() Overrides org. INTERNAL: Indicates whether the platform supports sequence objects.
| |
| toNumberOperator | back to summary |
|---|---|
| protected ExpressionOperator toNumberOperator() INTERNAL: Postgres to_number has two arguments, as fix format argument. | |
| writeUpdateOriginalFromTempTableSql | back to summary |
|---|---|
| public void writeUpdateOriginalFromTempTableSql(Writer writer, DatabaseTable table, Collection<DatabaseField> pkFields, Collection<DatabaseField> assignedFields) throws IOException Overrides org. INTERNAL: May need to override this method if the platform supports temporary tables and the generated sql doesn't work. Write an sql string for updating the original table from the temporary table. Precondition supportsTempTables() == true. Precondition pkFields and assignFields don't intersect.
| |