postgresqlpostgresql-11postgresql-12

How to fix 'type abstime does not exist' error when upgrading PostgreSQL from 11.20 to 12.15?


Trying to upgrade PostgreSQL from 11.20 to 12.15 and hitting the below error

pg_restore: error: could not execute query: ERROR: type "abstime" does not exist

I do understand that Data types abstime, reltime, and tinterval were removed by postgres under enhancements or version upgrades. but I believe there must be someone in the community who must have faced this issue and managed to find a solution to this problem.

is there anyone in community could help as would like to make progress and keep things secure.

tried to look into KB articles but couldn't find any solution. Looking for solution


Solution

  • Replace all occurrences of abstime with timestamp(0) with time zone. You'll have to do that in the v11 database before you upgrade, unless you want to manually edit a dump file.

    abstime had been deprecated for almost 20 years when it was removed, and it had a Y2038 problem.

    Here is a command to convert a column as described above:

    ALTER TABLE table_name
       ALTER column_name TYPE timestamp(0) with time zone;