Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phE0R-0007sH-P6 for pgsql-general@arkaria.postgresql.org; Tue, 28 Mar 2023 18:25:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1phE0Q-0005IZ-Ll for pgsql-general@arkaria.postgresql.org; Tue, 28 Mar 2023 18:25:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phE0Q-0005IP-8i for pgsql-general@lists.postgresql.org; Tue, 28 Mar 2023 18:25:14 +0000 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1phE0O-0001We-BL for pgsql-general@lists.postgresql.org; Tue, 28 Mar 2023 18:25:13 +0000 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-17786581fe1so13655873fac.10 for ; Tue, 28 Mar 2023 11:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680027910; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JmJqUq+k4x9kEpddGqsLHA/jdKhvDQxtEjcSJQJYpVw=; b=nlwo4hsEI2DCa5OO5V2QUNxWDHcIU2W6Fh+K3XNIM+uM+XrAYrGwrncxPIRuDhuzEu RND78YwmPaOjaRtNTRq2ui0owg1f8v78xRyBLBiKwM3LvBlltgIEroc80GlmNmoTwVeq PXFmgvrvAya96GQ3A3N4Krry6EtMvXmuUopYxO5sl7yENHQkw/MIkTrbKnReVoMt54IM +zlRWT5I/XOHaf59lH1cF0R9evGblocCNqMS6XRCiYCQaVvt2NZN6/6tfXd+/tXT5XdX ia4NuNAUadmA2znyVn69LTnvR3pocrusBane2mZpu0CyjJ39FlsaZ5f4Mope1JmSdD9g xrcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680027910; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JmJqUq+k4x9kEpddGqsLHA/jdKhvDQxtEjcSJQJYpVw=; b=lEmtTNeqMFOjr5LEqQAkaiV/qIkovKOE6luv4gZ4clM8wrZvcRb+v9spa6hclGJIV+ bdXLkRchUJYOnvXIUWclmPiRvUvJ92ho+Xx167N6HN99oe1LpcmPX76pBWSwoEl+stnY Cl/NkrgfuDIObD514KsfB9ybYUuZlpgQT5lAEif57MQjQrVjlyMBIzDa8On7s8agpRPW ausJ4lWXmG75Mw8/2HXlEkDiTD7em1/Qg1ZE2NBavibCVBdlrdaATuaeJpJKZ/MtbImH ADHBPAF/7EPrDmxiToM3mMlzkf60h4myL+arWxridYK+joJlTpKMpbP3fG+EmxcQMImO 3nmw== X-Gm-Message-State: AAQBX9dHXz66qrpajEqNfpstDMfYuqrWy74vVxU9yMjucvh6GRmXMDKp mhmYhOiv82bGV1+RtZpU379hwyBNLfxsJJ7fEshAJ4jE X-Google-Smtp-Source: AKy350auLShJRAKtAWBOnjwt9hRhMAiyBDbhZxEhTZJNRxaziYkkMLQuGkOlSoX54KEzcGFfOq2MCyXqREdhQuumOaQ= X-Received: by 2002:a05:6871:e45:b0:17f:1723:fc82 with SMTP id vk5-20020a0568710e4500b0017f1723fc82mr3186665oab.9.1680027910360; Tue, 28 Mar 2023 11:25:10 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Kirk Wolak Date: Tue, 28 Mar 2023 14:24:44 -0400 Message-ID: Subject: Re: Using CTID system column as a "temporary" primary key To: Sebastien Flaesch Cc: Geoff Winkless , pgsql-general Content-Type: multipart/alternative; boundary="000000000000cf525c05f7f9fa04" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cf525c05f7f9fa04 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Mar 28, 2023 at 6:40=E2=80=AFAM Sebastien Flaesch wrote: > ... > > > I think if you're honest with yourself you already know the answer to thi= s > question. The only real solution is to update the legacy code to use the > primary key, or (if that's not possible) change the table definition to a= dd > your own indexed BIGSERIAL value called "ROWID" to the rows and use that > instead (assuming it will be large enough). > > Geoff > I have to second this... Why not, during conversion, create a ROWID BIGSERIAL column in the PG only version. (And if not large enough, it's easy enough to use a NUMERIC field, and a sequence) Then the code would have access to this field, and when it uses it to delete/update it should work. I cringe at the thought of using CTID. And while it's probably "safe enough" inside a single transaction. I doubt that there is much "testing" of this concept. Having been through this process (Oracle to PG), I wonder how far you are into the process... Because Packages/Package Variables, Global Temp Tables, and Autonomous Transactions all consumed significant time in our process, as well as variable/field naming problems... If you pull off converting this to PG without changing the source. Let me know... Regards, Kirk --000000000000cf525c05f7f9fa04 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Mar 28, 2023 at 6:40=E2=80=AFAM S= ebastien Flaesch <sebastien= .flaesch@4js.com> wrote:
...
=C2=A0
I think if you're honest with yourself you already know the answer to t= his question. The only real solution is to update the legacy code to use th= e primary key, or (if that's not possible) change the table definition = to add your own indexed BIGSERIAL value called "ROWID" to the rows and use that instead (assuming it wil= l be large enough).

Geoff

I have= to second this...=C2=A0 Why not, during conversion, create a ROWID BIGSERI= AL column in the PG only version.=C2=A0 (And if not large enough, it's = easy enough to use a NUMERIC field, and a sequence)
Then the code would = have access to this field, and when it uses it to delete/update it should w= ork.

I cringe at the thought of using CTID.=C2=A0 And while it's= probably "safe enough" inside a single transaction.=C2=A0 I doub= t that there is much "testing" of this concept.=C2=A0

Havi= ng been through this process (Oracle to PG), I wonder how far you are into = the process...=C2=A0 Because Packages/Package Variables, Global Temp Tables= , and Autonomous Transactions all consumed significant time in our process,= as well as variable/field naming problems...=C2=A0 If you pull off convert= ing this to PG without changing the source.=C2=A0 Let me know...
=
Regards, Kirk
--000000000000cf525c05f7f9fa04--