public inbox for [email protected]
help / color / mirror / Atom feedIdentity column data type difference in PostgreSQL and Oracle
2+ messages / 2 participants
[nested] [flat]
* Identity column data type difference in PostgreSQL and Oracle
@ 2024-05-03 10:57 Muhammad Ikram <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Ikram @ 2024-05-03 10:57 UTC (permalink / raw)
To: PostgreSQL General <[email protected]>
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Identity column data type difference in PostgreSQL and Oracle
@ 2024-05-03 11:09 Peter Eisentraut <[email protected]>
parent: Muhammad Ikram <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Peter Eisentraut @ 2024-05-03 11:09 UTC (permalink / raw)
To: Muhammad Ikram <[email protected]>; PostgreSQL General <[email protected]>
On 03.05.24 12:57, Muhammad Ikram wrote:
> 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.
Sequences in PostgreSQL are limited to bigint, there is nothing that can
be changed about that. But you are approximately the first person to
complain that the range of ids provided by bigint is too small, so maybe
it's worth reconsidering whether it would work for you. If it really is
too small, maybe a uuid would work. But yes, you'll need to make some
adjustments to the rest of your database or application code if you make
such changes.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-05-03 11:09 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03 10:57 Identity column data type difference in PostgreSQL and Oracle Muhammad Ikram <[email protected]>
2024-05-03 11:09 ` Peter Eisentraut <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox