Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2qdM-006h2K-A0 for pgsql-general@arkaria.postgresql.org; Fri, 03 May 2024 10:59:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s2qcJ-008EfD-LC for pgsql-general@arkaria.postgresql.org; Fri, 03 May 2024 10:58:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2qcJ-008Ef5-Ar for pgsql-general@lists.postgresql.org; Fri, 03 May 2024 10:58:16 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s2qcH-001KW4-OM for pgsql-general@lists.postgresql.org; Fri, 03 May 2024 10:58:15 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2e1fa1f1d9bso26793811fa.0 for ; Fri, 03 May 2024 03:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714733891; x=1715338691; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=UC7gdZj5Us0H8Uz5vdKpNoq1dzGSNFnEsy1B95WshSY=; b=jxMwFsME08liESCGY3yG1NW2dYUqcI0acXAah422p/e6FoIq0QcdpAIdlh2Umo/D8u 5c0/SOsZe7yHBMA2AUAykKioJQa2lLXiiyzPgqtqOS/JdTbkrXAGCaf9cZCtvjAhXYvr 1F6l2StYEsBj9i6BAUZqGfqQvraBfbMxvhr+Wd8icztLnEhK7y3FAuIoIGOGcWEoPArX h+Q4MmSAXJnJ3lbpZEdD/9y+Tkq1i6xHHId56N3tvdOtxfd8KHP561kdGtJFT8Cwc2/X evRn4MLMFnF8asVWFBtRiA8D1xdpq2w00QqRXOeVQU11rUCxt2SM94MSX7PYqX3ua5CX AGnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714733891; x=1715338691; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=UC7gdZj5Us0H8Uz5vdKpNoq1dzGSNFnEsy1B95WshSY=; b=TfJHjBbRCH/Xwp9U9XIcL54VfPGzn348UJKxYF1cqJqH0TSjs7/YbqutaOGmxkiWRA /vLBz8m4hI7lt0dDlouFVaKvIgLmGBT5z4Za7lhmJoxEwWrm+25E2W5S+KJucE4LXEmn yNh+DaRm/QxYlmVnmi7utxe4vwPkvZlpHbAVXph7dPfNIyeEi3l39CYP/mtPZlBCl/Hu LuOowcqwKriyE0nAPLwUTEtHnGN4RdkBnTsKD5GFsjmRQWm0BDsPqXESrV0hBjJyqGnA uZG0HLG7/A2Fr1WcoOM3RmsSy9kzsgRospTqE+TzqOPXTf5iG0Pea09H2M9spBEI55iN RPjw== X-Gm-Message-State: AOJu0YzkRnbKyyEARwpRheeRZdxJL47wnBt2cOjaKi/ioC1DmyCZw6y0 Yw5tRjxvfJhMh3a7+TeFBaATlF61zYb6ra1OT9hNSvI6vUl6f2TUznmX+0/nW1Po+ElzxF9/Wr2 QdR++N86xDL4SQ2fbODylqlCEfTMY+iCg X-Google-Smtp-Source: AGHT+IFB86Rjjb8rK/5KdiPh3108WqfOzl4DcPZZvMenu13uRdv4qf8N9xjDzWioIkxokKYhxkPztP9l7yER4s3Jn+Q= X-Received: by 2002:a2e:b04a:0:b0:2df:b2d5:5935 with SMTP id d10-20020a2eb04a000000b002dfb2d55935mr2129099ljl.28.1714733890923; Fri, 03 May 2024 03:58:10 -0700 (PDT) MIME-Version: 1.0 From: Muhammad Ikram Date: Fri, 3 May 2024 15:57:53 +0500 Message-ID: Subject: Identity column data type difference in PostgreSQL and Oracle To: PostgreSQL General Content-Type: multipart/alternative; boundary="00000000000073f73606178a9822" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000073f73606178a9822 Content-Type: text/plain; charset="UTF-8" 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 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 --00000000000073f73606178a9822 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,=C2=A0

Tables which have an identity column i= n Oracle when migrated to PostgreSQL, the data type of Identity column is c= hanged to bigint from number by the tools. This causes the size of column= =C2=A0to be reduced to max value supported by bigint which is way lower tha= n the oracle=C2=A0 number max.
Secondly one has to change referencing co= lumns data type as well.

What should be a better strategy for such = transformations ?

Sample tables

CREATE= TABLE Sales (
=C2=A0 =C2=A0 transaction_id NUMBER GENERATED ALWA= YS AS IDENTITY MINVALUE 1 MAXVALUE <maxvaluefornumberdatatype> INCREM= ENT BY 1 START WITH 1 =C2=A0NOCYCLE
=C2=A0 =C2=A0 customer VARCHAR2(100)= ,
=C2=A0 =C2=A0 transaction_date DATE,
=C2=A0 =C2=A0 store_id NUMBER<= br>);

CREATE TABLE Sales_Details (
=C2=A0 =C2=A0 transaction_i= d NUMBER,
=C2=A0 =C2=A0 item VARCHAR2(100),
=C2=A0 =C2=A0 quantit= y NUMBER,
=C2=A0 =C2=A0 price NUMBER,
=C2=A0 =C2=A0 CONSTRAINT fk_tra= nsaction_id FOREIGN KEY (transaction_id) REFERENCES Sales(transaction_id));

--
Regards,
Muhammad Ikram

--00000000000073f73606178a9822--