Class PostgresDatabaseDialect
java.lang.Object
io.debezium.connector.jdbc.dialect.GeneralDatabaseDialect
io.debezium.connector.jdbc.dialect.postgres.PostgresDatabaseDialect
- All Implemented Interfaces:
DatabaseDialect
A
DatabaseDialect implementation for PostgreSQL.- Author:
- Chris Cranford
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePostgresDatabaseDialect(JdbcSinkConnectorConfig config, org.hibernate.SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionReturns the default format for binding a byte arraygetFormattedBoolean(boolean value) Format a boolean.Format a date and time with nonoseconds.getFormattedTime(ZonedDateTime value) Format a time.intGets the maximum precision allowed for a dialect's timestamp data type.intGets the maximum length of a VARCHAR field in a primary key column.getUpsertStatement(TableDescriptor table, SinkRecordDescriptor record) Construct aUPSERTstatement specific for this dialect.readTable(Connection connection, String tableName) Read the table structure data from the database.protected voidbooleantableExists(Connection connection, String tableName) Check whether the specified table exists.Methods inherited from class io.debezium.connector.jdbc.dialect.GeneralDatabaseDialect
addColumnDefaultValue, bindValue, columnNameFromField, columnNameFromField, columnQueryBindingFromField, getAlterTableStatement, getColumnNamingStrategy, getConfig, getCreateTableStatement, getDatabaseVersion, getDefaultDecimalPrecision, getDefaultTimestampPrecision, getDeleteStatement, getFormattedDate, getFormattedDateTime, getFormattedTimestamp, getFormattedTimestampWithTimeZone, getFormattedTimeWithTimeZone, getIdentifierHelper, getInsertStatement, getMaxNVarcharLengthInKey, getMaxVarbinaryLength, getSchemaType, getTypeName, getTypeName, getTypeName, getUpdateStatement, getVersion, isIdentifierUppercaseWhenNotQuoted, isNegativeScaleAllowed, registerType, resolveMissingFields, toIdentifier, toIdentifierMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.debezium.connector.jdbc.dialect.DatabaseDialect
getMaxTimePrecision
-
Constructor Details
-
PostgresDatabaseDialect
private PostgresDatabaseDialect(JdbcSinkConnectorConfig config, org.hibernate.SessionFactory sessionFactory)
-
-
Method Details
-
getMaxTimestampPrecision
public int getMaxTimestampPrecision()Description copied from interface:DatabaseDialectGets the maximum precision allowed for a dialect's timestamp data type.- Returns:
- maximum timestamp precision
-
tableExists
Description copied from interface:DatabaseDialectCheck whether the specified table exists.- Specified by:
tableExistsin interfaceDatabaseDialect- Overrides:
tableExistsin classGeneralDatabaseDialect- Parameters:
connection- the database connection to be used, should not benull.tableName- the table name to check for, should not benull.- Returns:
- true if the table exists, false otherwise
- Throws:
SQLException- if a database exception occurs
-
readTable
Description copied from interface:DatabaseDialectRead the table structure data from the database.- Specified by:
readTablein interfaceDatabaseDialect- Overrides:
readTablein classGeneralDatabaseDialect- Parameters:
connection- the database connection to be used, should not benull.tableName- the table name to read the structure for, should not benull.- Returns:
- the table relational model if it exists
- Throws:
SQLException- if the table does not exist or a database exception occurs
-
getUpsertStatement
Description copied from interface:DatabaseDialectConstruct aUPSERTstatement specific for this dialect.- Specified by:
getUpsertStatementin interfaceDatabaseDialect- Overrides:
getUpsertStatementin classGeneralDatabaseDialect- Parameters:
table- the current relational table model, should not benullrecord- the current sink record being processed, should not benull- Returns:
- the upsert SQL statement to be executed, never
null
-
getByteArrayFormat
Description copied from interface:DatabaseDialectReturns the default format for binding a byte array- Specified by:
getByteArrayFormatin interfaceDatabaseDialect- Overrides:
getByteArrayFormatin classGeneralDatabaseDialect- Returns:
- the format for binding a byte array
-
getFormattedBoolean
Description copied from interface:DatabaseDialectFormat a boolean.- Specified by:
getFormattedBooleanin interfaceDatabaseDialect- Overrides:
getFormattedBooleanin classGeneralDatabaseDialect- Parameters:
value- the boolean value- Returns:
- the formatted string value
-
getFormattedDateTimeWithNanos
Description copied from interface:DatabaseDialectFormat a date and time with nonoseconds.- Specified by:
getFormattedDateTimeWithNanosin interfaceDatabaseDialect- Overrides:
getFormattedDateTimeWithNanosin classGeneralDatabaseDialect- Parameters:
value- the value to be formatted, nevernull- Returns:
- the formatted string value
-
getFormattedTime
Description copied from interface:DatabaseDialectFormat a time.- Specified by:
getFormattedTimein interfaceDatabaseDialect- Overrides:
getFormattedTimein classGeneralDatabaseDialect- Parameters:
value- the value to be formatted, nevernull- Returns:
- the formatted string value
-
registerTypes
protected void registerTypes()- Overrides:
registerTypesin classGeneralDatabaseDialect
-
getMaxVarcharLengthInKey
public int getMaxVarcharLengthInKey()Description copied from interface:DatabaseDialectGets the maximum length of a VARCHAR field in a primary key column.- Specified by:
getMaxVarcharLengthInKeyin interfaceDatabaseDialect- Overrides:
getMaxVarcharLengthInKeyin classGeneralDatabaseDialect- Returns:
- maximum varchar field length when participating in the primary key
-