Re: Should new partitions inherit their tablespace from their parent?

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-12-16T23:59:49Z
Lists: pgsql-hackers
On Sun, Dec 16, 2018 at 07:07:35PM -0300, Alvaro Herrera wrote:
> I'll self-review this again tomorrow, 'cause I now have to run.

> -		if (!is_partition)
> -			relation = heap_openrv(parent, ShareUpdateExclusiveLock);
> -		else
> -			relation = heap_openrv(parent, AccessExclusiveLock);
> +		/* caller already got lock */
> +		relation = heap_open(parent, NoLock);

Okay, I think that you should add an assertion on
CheckRelationLockedByMe() as MergeAttributes()'s only caller is
DefineRelation().  Better safe than sorry later.
--
Michael

Commits

  1. Fix tablespace handling for partitioned tables