ora2pg icon indicating copy to clipboard operation
ora2pg copied to clipboard

When using MODIFY_TYPE, default values from Oracle should be removed

Open marie-joechahine opened this issue 3 years ago • 0 comments

I decided to change the type of one of the columns being imported, but ran into a problem since the field in Oracle had a default value and it is being imported, but the default value does not work with the new type.

Do you think that default value should be removed when we add a column to MODIFY_TYPE?

Here is my example, I no longer want to use a sequence for the ID, I found that this works if i remove manually the DEFAULT nextval('seq_policy_cover') from the resulting schema file:

Column in oracle: "ID" NUMBER(10,0) DEFAULT "CMS"."SEQ_POLICY_COVER"."NEXTVAL" NOT NULL

In the config file, I changed it to: table_name:id:int GENERATED ALWAYS AS IDENTITY

Exported to PostgreSQL as: id int generated always as identity NOT NULL DEFAULT nextval('seq_policy_cover')

marie-joechahine avatar Mar 12 '21 13:03 marie-joechahine