Re: System column support for partitioned tables using heap

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Morris de Oryx <morrisdeoryx(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: System column support for partitioned tables using heap
Date: 2022-07-18 20:12:55
Message-ID: CA+TgmobP786U_7FXDkROsngZMi2zSxs6sUChYfv0AWwuxqCduw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 17, 2022 at 9:04 PM Morris de Oryx <morrisdeoryx(at)gmail(dot)com> wrote:
> This fails on a partitioned table because xmax() may not exist. In fact, it does exist in all of those tables, but the system doesn't know how to guarantee that. I know which tables are partitioned, and can downgrade the result on partitioned tables to the count(*) I've been using to date. But now I'm wondering if working with xmax() like this is a poor idea going forward. I don't want to lean on a feature/behavior that's likely to change. For example, I noticed the other day that MERGE does not support RETURNING.
>
> I'd appreciate any insight or advice you can offer.

What is motivating you to want to see the xmax value here? It's not an
unreasonable thing to want to do, IMHO, but it's a little bit niche so
I'm just curious what the motivation is.

I do agree with you that it would be nice if this worked better than
it does, but I don't really know exactly how to make that happen. The
column list for a partitioned table must be fixed at the time it is
created, but we do not know what partitions might be added in the
future, and thus we don't know whether they will have an xmax column.
I guess we could have tried to work things out so that a 0 value would
be passed up from children that lack an xmax column, and that would
allow the parent to have such a column, but I don't feel too bad that
we didn't do that ... should I?

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martin Kalcher 2022-07-18 20:15:43 Re: [PATCH] Introduce array_shuffle() and array_sample()
Previous Message Bruce Momjian 2022-07-18 20:09:40 Re: pg15b2: large objects lost on upgrade