[fix](cdc)fix the error mapping default values from RDBMS to Doris #308
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
Issue Number: close #xxx
Problem Summary:
Currently, Doris only supports
current_timestamp
as the default function.In relational databases, the composition of different default values varies. Here are some examples:
1.MySQL
In MySQL, default values for numeric types are represented as
1.0
or0
, while for string and date types, they are enclosed in single quotes.In MySQL5.7.x,you can create SQL statements using the following syntax:
In MySQL8.0.x,you can create table with default function.
2.Oracle
In Oracle, character types are enclosed in single quotes, while the default values for timestamps and dates are obtained through the
TO_TIMESTAMP
andTO_DATE
functions, respectively. Here are some specific examples:3.PostgreSQL
In PostgreSQL, default values for character and numeric types are composed of the value itself, followed by
::
and the type.4.SQLSever
In SQL Server, numeric types are enclosed in double parentheses
()
, while string and time types are enclosed in single parentheses()
.In this PR, you can automatically map default values from MySQL, Oracle, PostgreSQL, and SQL Server to Doris default values. Currently, only the translation of the time default function current_timestamp is supported.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...