Skip to content

[FEATURE] Support switching between non-coercible types via drop/add #179

@aleclarson

Description

@aleclarson

Describe the bug

Incompatible cast does not result in DROP COLUMN followed by ADD COLUMN.

This is occurring for me with all hazards allowed and plan validation disabled.

Error: executing migration statement. the database maybe be in a dirty state: 
{ALTER TABLE "public"."activity" ALTER COLUMN "ts" SET DATA TYPE timestamp with 
time zone using "ts"::timestamp with time zone 3s 3s 
[ACQUIRES_ACCESS_EXCLUSIVE_LOCK: This will completely lock the table while the data 
is being re-written. The duration of this conversion depends on if the type conversion 
is trivial or not. A non-trivial conversion will require a table rewrite. A trivial 
conversion is one where the binary values are coercible and the column contents are not 
changing.]}: 
ERROR: cannot cast type integer to timestamp with time zone (SQLSTATE 42846)

Expected behavior

DROP then ADD

To Reproduce

Change a column type from integer to timestamptz.

Context
pg-schema-diff version: 5fe8259
pg-schema-diff usage: CLI
Postgres version: 14

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions