public inbox for [email protected]  
help / color / mirror / Atom feed
From: Muhammad Ikram <[email protected]>
To: PostgreSQL General <[email protected]>
Subject: Identity column data type difference in PostgreSQL and Oracle
Date: Fri, 3 May 2024 15:57:53 +0500
Message-ID: <CAGeimVpSjtMuq_J8bL_U3qe4ZaH78sVc35sdjZWO9sqJyLtLnA@mail.gmail.com> (raw)

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


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Identity column data type difference in PostgreSQL and Oracle
  In-Reply-To: <CAGeimVpSjtMuq_J8bL_U3qe4ZaH78sVc35sdjZWO9sqJyLtLnA@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox