Identity column data type difference in PostgreSQL and Oracle

From: Muhammad Ikram <mmikram(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Identity column data type difference in PostgreSQL and Oracle
Date: 2024-05-03 10:57:53
Message-ID: CAGeimVpSjtMuq_J8bL_U3qe4ZaH78sVc35sdjZWO9sqJyLtLnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

Tables which have an identity column in Oracle when migrated to PostgreSQL,
the data type of Identity column is changed to bigint from number by the
tools. This causes the size of column to be reduced to max value supported
by bigint which is way lower than the oracle number max.
Secondly one has to change referencing columns data type as well.

What should be a better strategy for such transformations ?

Sample tables

CREATE TABLE Sales (
*transaction_id* NUMBER GENERATED ALWAYS AS IDENTITY MINVALUE 1
MAXVALUE <maxvaluefornumberdatatype> INCREMENT BY 1 START WITH 1 NOCYCLE
customer VARCHAR2(100),
transaction_date DATE,
store_id NUMBER
);

CREATE TABLE Sales_Details (
*transaction_id* NUMBER,
item VARCHAR2(100),
quantity NUMBER,
price NUMBER,
CONSTRAINT fk_transaction_id FOREIGN KEY (transaction_id) REFERENCES
Sales(transaction_id)
);

--
Regards,
Muhammad Ikram

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2024-05-03 11:09:41 Re: Identity column data type difference in PostgreSQL and Oracle
Previous Message Avinash Vallarapu 2024-05-03 09:38:31 Re: Ora2pg Delta Migration: Oracle to PostgreSQL