Re: default partition and concurrent attach partition

Alvaro Herrera <alvherre@2ndquadrant.com>

From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Amit Langote <amitlangote09@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>, Robert Haas <robertmhaas@gmail.com>, hawu@vmware.com
Date: 2020-09-03T21:02:06Z
Lists: pgsql-hackers
On 2020-Sep-03, Alvaro Herrera wrote:

> +	/*
> +	 * If setting up a PartitionDispatch for a sub-partitioned table, we may
> +	 * also need a fake ResultRelInfo for checking the partition constraint
> +	 * later; set that up now.
> +	 */
> +	if (parent_pd)
> +	{
> +		ResultRelInfo *rri = makeNode(ResultRelInfo);
> +
> +		InitResultRelInfo(rri, rel, 1, proute->partition_root, 0);
> +		proute->nonleaf_partitions[dispatchidx] = rri;
> +	}
> +

Heh, I had intended to remove the attachment before sending, because I
thought I was seeing a problem with this proposed coding of mine.  But
since I sent it by mistake, I'll explain: I think this will fail if we
have a partitioned default partition, and we direct the insert to it
directly while attaching a partition to its parent.  I think that kind
of scenario deserves its own test case.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Commits

  1. Check default partitions constraints while descending