tencent cloud

Feedback

Structural Compatibility Check

Last updated: 2024-07-08 19:56:53

    Check Details

    If the target database version is 12 or later, and the table to be migrated contains the data types abstime, reltime, and tinterval, the verification task reports an error.
    The data types abstime, reltime, and tinterval are older time and date types that have been deprecated in the new PostgreSQL versions. It is recommended to use the following types as replacements:
    abstime: You can use timestamp or timestamp with time zone as replacements. These types provide a broader range of date and time representation capabilities.
    reltime: You can use the interval type as a replacement. The interval type is used to represent time intervals, which can include units such as years, months, days, hours, minutes, and seconds.
    tinterval: You can use tsrange or tstzrange as replacements. These types are used to represent time ranges, which can include the origin and end times.

    Fixing Solution

    The methods for modifying the data types abstime, reltime, and tinterval are similar. First, create a column, convert the old data format to the new one, and store it in the new one. After the new column's data is verified that it is correct, delete the old column. Finally, if necessary, rename the new column to the name of the old column.
    Below is an introduction to modifying abstime to timestamp as an example.
    1. In the table where the verification task prompts 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 result in the new column.
    UPDATE your_table SET new_column = your_abstime_column::TIMESTAMP;
    3. Verify whether the data in the new column is correct.
    SELECT * FROM your_table;
    4. If the data in the new column is correct, you can delete the old abstime column.
    ALTER TABLE your_table DROP COLUMN your_abstime_column;
    5. If necessary, you can rename the new column to the name of the old column.
    ALTER TABLE your_table RENAME COLUMN new_column TO your_abstime_column;
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support