tencent cloud

Data Transfer Service

Structure Compatibility Check

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-04-20 17:09:32

Checking Details

If the target database version is PostgreSQL 12 or later, and the tables to be migrated contain the abstime, reltime, and tinterval data types, the check task will report an error.
The abstime, reltime, and tinterval data types are outdated time and date types that have been deprecated in later PostgreSQL versions. It is recommended to use the following types as replacements:
abstime can be replaced with timestamp or timestamp with time zone, both of which offer broader date and time representation capabilities.
reltime can be replaced with interval. The interval type is used to represent time intervals and can include units such as years, months, days, hours, minutes, and seconds.
tinterval can be replaced with tsrange or tstzrange, both of which are used to represent time ranges and can include a start time and an end time.

Fixing Methods

The modification methods for the abstime, reltime, and tinterval data types are similar: First, create a column, convert the old data type to the new data format, and store it in the new column. After verifying that the data in the new column is correct, delete the old column. Finally, rename the new column to the name of the old column as needed.
The process of changing abstime to timestamp is described below as an example.
1. In the table where the check task reported an error, add a new column of the timestamp type.
ALTER TABLE your_table ADD COLUMN new_column TIMESTAMP;
2. Convert the data in the abstime column to the timestamp type and store the results in a new column.
UPDATE your_table SET new_column = your_abstime_column::TIMESTAMP;
3. Verify that the data in the new column is correct.
SELECT * FROM your_table;
4. If the data in the new column is correct, the old abstime column can be deleted.
ALTER TABLE your_table DROP COLUMN your_abstime_column;
5. If needed, rename the new column to the name of the old column.
ALTER TABLE your_table RENAME COLUMN new_column TO your_abstime_column;


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan