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

From: Christophe Pettus <xof(at)thebuild(dot)com>
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
Date: 2023-03-28 12:39:27
Message-ID: BDED177C-F85C-4667-A67C-C083DD76A9E2@thebuild.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> 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 Dominique Devienne 2023-03-28 12:45:57 Plans for ON DELETE CASCADE? Which index is used, if at all?
Previous Message Sebastien Flaesch 2023-03-28 10:39:54 Re: Using CTID system column as a "temporary" primary key