Re: System column support for partitioned tables using heap

2022-07-21 Thread Robert Haas
On Tue, Jul 19, 2022 at 11:22 PM Morris de Oryx wrote: > It might help if I show a sample insert handling function. The issue is with > the line at the end of the top CTE, insert_rows: > > returning xmax as inserted_transaction_id), > > That's what fails on partitions. Is there an alterna

Re: System column support for partitioned tables using heap

2022-07-19 Thread Morris de Oryx
On Tue, Jul 19, 2022 at 10:38 PM Robert Haas wrote: > For MERGE itself, I wonder if some information about this should be > included in the command tag. It looks like MERGE already includes some > sort of row count in the command tag, but I guess perhaps it doesn't > distinguish between inserts

Re: System column support for partitioned tables using heap

2022-07-19 Thread Robert Haas
On Tue, Jul 19, 2022 at 4:44 AM Morris de Oryx wrote: > My reason for xmax() in the result is to break down the affected rows count > into an insert count, and a modified estimate. Not super critical, but > helpful. I've built out some simple custom logging table in out system for > this kind o

Re: System column support for partitioned tables using heap

2022-07-19 Thread Morris de Oryx
> 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. Right, seeing what you're meaning there. It's fantastic that a partition might be an

Re: System column support for partitioned tables using heap

2022-07-19 Thread Morris de Oryx
> 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. Yeah, I figured it was niche when I saw so little mention of the issue. My reason for xmax() in the result i

Re: System column support for partitioned tables using heap

2022-07-18 Thread Robert Haas
On Sun, Jul 17, 2022 at 9:04 PM Morris de Oryx 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 pa

System column support for partitioned tables using heap

2022-07-17 Thread Morris de Oryx
I've run into an existing behavior where xmax(), and various other system tables, return an error when included in the RETURNING list on a partitioned table. ERROR: cannot retrieve a system column in this context ` This issue got a fair airing back in 2020: AW: posgres 12 bug (partitioned table)