pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Using CTID system column as a "temporary" primary key
Date: Wed, 29 Mar 2023 12:15:09 -0700
Message-ID: <8708606d-e6f2-07f5-b374-465224de9c66@aklaver.com> (raw)
In-Reply-To: <20230329164337.7px2drewpfrjyjqw@hjp.at>
References: <DBAP191MB12891F47802C3674F77BF751B0889@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>
	<CAEzk6feEGHzS_TexvevFmWhsYt7MYhUUEUE54stO7SPNbL_Ypg@mail.gmail.com>
	<DBAP191MB1289536BFF22FD8BD5FFEC61B0889@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>
	<CACLU5mQ2XMd5c4tetUHacVE538c8nd1t2CWSfDvis2GCKg0L9A@mail.gmail.com>
	<DBAP191MB1289D8F0F4A8CB1423ADB05FB0899@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM>
	<b121c195-8122-3167-5e33-3bd325702df5@aklaver.com>
	<20230329164337.7px2drewpfrjyjqw@hjp.at>

On 3/29/23 09:43, Peter J. Holzer wrote:
> On 2023-03-29 07:59:54 -0700, Adrian Klaver wrote:
>> On 3/29/23 07:19, Sebastien Flaesch wrote:
>>> INSERT statements must not use the serial column, so you have to list
>>> all columns of the table and provide only the values of the non-serial
>>> columns. With Informix you could just specific a zero to get a new
>>> generated serial, but seems this has never been considered with
>>> PostgreSQL.
>>
>> Yes it has:
> [...]
>> insert into seq_test values(default, 'test');
> 
> Default is not the same as zero.

It accomplishes the same thing, a place holder value can be used to fire 
the sequence without column qualifying the insert/update. Furthermore it 
works over all columns. So I would say it has been considered by 
Postgres as a way to 'to get a new generated serial'.

> 
>          hp
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






view thread (28+ messages)  latest in thread

Message-ID: <8708606d-e6f2-07f5-b374-465224de9c66@aklaver.com>
Permalink:  ../8708606d-e6f2-07f5-b374-465224de9c66@aklaver.com/
Also on:    postgresql.org/message-id/8708606d-e6f2-07f5-b374-465224de9c66@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com
  Subject: Re: Using CTID system column as a "temporary" primary key
  In-Reply-To: <8708606d-e6f2-07f5-b374-465224de9c66@aklaver.com>
  References: <DBAP191MB12891F47802C3674F77BF751B0889@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM> <CAEzk6feEGHzS_TexvevFmWhsYt7MYhUUEUE54stO7SPNbL_Ypg@mail.gmail.com> <DBAP191MB1289536BFF22FD8BD5FFEC61B0889@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM> <CACLU5mQ2XMd5c4tetUHacVE538c8nd1t2CWSfDvis2GCKg0L9A@mail.gmail.com> <DBAP191MB1289D8F0F4A8CB1423ADB05FB0899@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM> <b121c195-8122-3167-5e33-3bd325702df5@aklaver.com> <20230329164337.7px2drewpfrjyjqw@hjp.at> <8708606d-e6f2-07f5-b374-465224de9c66@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox