Re: Should new partitions inherit their tablespace from their parent?
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-12-16T22:07:35Z
Lists: pgsql-hackers
Attachments
- v5-0001-Allow-newly-created-partitions-to-inherit-their-p.patch (text/x-diff) patch v5-0001
I didn't like this, so I rewrote it a little bit. First, I changed the Assert() to use the macro for relations with storage that I just posted in the other thread that Michael mentioned. I then noticed that we're doing a heap_openrv() in the parent relation and closing it before MergeAttribute() does the same thing all over again; also MergeAttribute has the silly array-of-OIDs return value for the parents so that DefineRelation can handle it again later. Rube Goldberg says hi. I changed this so that *before* doing anything with the parent list, we transform it to a list of OIDs, and lock them; so MergeAttributes now receives the list of OIDs of parents rather than RangeVars. We can also move the important comment (about lock level of parent rels) buried in the bowels of MergeAttribute to the place where it belongs in DefineRelation; and we no longer have to mess with transforming names to OIDs multiple times. Proposed patch attached. I'll self-review this again tomorrow, 'cause I now have to run. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Fix tablespace handling for partitioned tables
- ca4103025dfe 12.0 landed