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

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>, Kirk Wolak <wolakk(at)gmail(dot)com>, 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-30 12:32:57
Message-ID: CAFCRh-_1GBruWFy8T1Fw7RMK3BtCYLfQeDxsyirUbtrVfhPM3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 30, 2023 at 11:42 AM Francisco Olarte <folarte(at)peoplecall(dot)com>
wrote:

> On Thu, 30 Mar 2023 at 10:01, Dominique Devienne <ddevienne(at)gmail(dot)com>
> wrote:
> > BTW, default and 0 are not the same thing. You cannot bind "default" in
> place of
> > an integer-valued prepared-statement placeholder, in a binary mode
> insert. So it is
> > definitely not the same thing.
>
> IMNSHO if you need to select between default and explicit in an insert
> via binding you have a design problem, and down this path lies madness.
>

I fail to see that myself, sorry. You can bind NULL, you can bind values,
so why
wouldn't you be able to bind DEFAULT too? I see that more as a failing to
the
binding API myself :)

But I guess it can be worked around with something like
`... values(coalesce($1, default), ..)`
and abusing NULL to mean DEFAULT on a case-by-case bases.
Assuming default can be used in this way (didn't try), of course.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2023-03-30 15:13:53 Re: Using CTID system column as a "temporary" primary key
Previous Message vignesh C 2023-03-30 11:08:56 Re: Support logical replication of DDLs