DBZ-3710 Suggested changes

This commit is contained in:
Chris Cranford 2021-11-09 13:44:04 -05:00 committed by Gunnar Morling
parent f0a53e0c76
commit 5c2523cd73
2 changed files with 9 additions and 3 deletions

View File

@ -19,6 +19,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.debezium.annotation.Immutable;
import io.debezium.annotation.ThreadSafe;
import io.debezium.jdbc.JdbcConnection;
import io.debezium.relational.Column;
@ -37,6 +38,7 @@
* @author Chris Cranford
*/
@ThreadSafe
@Immutable
public class OracleDefaultValueConverter implements DefaultValueConverter {
private static Logger LOGGER = LoggerFactory.getLogger(OracleDefaultValueConverter.class);

View File

@ -1294,14 +1294,18 @@ A string representation of a timestamp in UTC.
[[oracle-default-values]]
=== Default Values
If a default value is specified for a column in the database schema, the Oracle connector will attempt to propagate this value to the Kafka schema whenever possible. Most common data types are supported, including:
If a default value is specified for a column in the database schema, the Oracle connector will attempt to propagate this value to the schema of the corresponding Kafka record field. Most common data types are supported, including:
* Character types (`CHAR`, `NCHAR`, `VARCHAR`, `VARCHAR2`, `NVARCHAR`, `NVARCHAR2`)
* Numeric types (`INTEGER`, `NUMERIC`, etc.)
* Temporal types (`DATE`, `TIMESTAMP`, `INTERVAL`, etc.)
Note that for temporal types, these are often represented by function calls and will be translated by an additional database call.
If a temporal type is represented by a constant, such as `SYSDATE`, the connector will instead export either `null` or `0` depending on the column's optionality.
If a temporal type uses a function call such as `TO_TIMESTAMP` or `TO_DATE` to represent the default value, the connector will resolve the default value by making an additional database call to evaluate the function.
For example, if a `DATE` column is defined with the default value of `TO_DATE('2021-01-02', 'YYYY-MM-DD')`, the column's default value will be the number of days since epoch for that date or `18629` in this case.
If a temporal type uses the `SYSDATE` constant to represent the default value, the connector will resolve this based on whether the column is defined as `NOT NULL` or `NULL`.
If the column is nullable, no default value will be set; however, if the column isn't nullable then the default value will be resolved as `0`.
For most temporal types, the default value type will be numeric except if the column is a `TIMESTAMP WITH TIME ZONE` or `TIMESTAMP WITH LOCAL TIME ZONE` in which case its emitted as a string.
// Type: assembly
// ModuleID: setting-up-oracle-to-work-with-debezium