Re: Using CTID system column as a "temporary" primary key

From: Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>
To: Christophe Pettus <xof(at)thebuild(dot)com>
Cc: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Using CTID system column as a "temporary" primary key
Date: 2023-03-28 14:23:06
Message-ID: DBAP191MB128940FF558474BC6DA80CB7B0889@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CAST seems to do the job so that's a good solution here.

Seb
________________________________
From: Christophe Pettus <xof(at)thebuild(dot)com>
Sent: Tuesday, March 28, 2023 2:39 PM
To: Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>
Cc: Geoff Winkless <pgsqladmin(at)geoff(dot)dj>; pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Using CTID system column as a "temporary" primary key

EXTERNAL: Do not click links or open attachments if you do not recognize the sender.

> On Mar 28, 2023, at 03:39, Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com> wrote:
> Do I have to cast() ?

Yes:

select * from t where ctid='(0,1)'::tid;

The string representation can be up to 17 characters: 10 for the page number, 4 for the tuple number, and three for the delimiters.

Remember that updating a row changes its CTID.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-03-28 14:26:47 Re: Cluster table based on grand parent?
Previous Message Adrian Klaver 2023-03-28 14:22:35 Re: Plans for ON DELETE CASCADE? Which index is used, if at all?