Re: unsupportable composite type partition keys
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <amitlangote09@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-12-23T21:33:55Z
Lists: pgsql-hackers
Attachments
- delay-loading-relcache-partition-data-2.patch (text/x-diff) patch
I wrote: > One thing I see is that you chose to relocate RelationGetPartitionDesc's > declaration to partdesc.h, whereupon RelationBuildPartitionDesc doesn't > have to be exported at all anymore. Perhaps that's a better factorization > than what I did. It supposes that any caller of RelationGetPartitionDesc > is going to need partdesc.h, but that seems reasonable. We could likewise > move RelationGetPartitionKey to partcache.h. I concluded that that is indeed a better solution; it does allow removing some rel.h inclusions (though possibly those were just duplicative?), and it also means that relcache.c itself doesn't need any partitioning inclusions at all. Here's a cleaned-up patch that does it like that and also fixes the memory leakage issue. I noticed along the way that with partkeys only being loaded on demand, we no longer need the incredibly-unsafe hack in RelationBuildPartitionKey whereby it just silently ignores failure to read the pg_partitioned_table entry. I also rearranged RelationBuildPartitionDesc so that it uses the same context-reparenting trick as RelationBuildPartitionKey. That doesn't save us anything, but it makes the code considerably more robust, I think; we don't need to assume as much about what partition_bounds_copy does. One other thing worth noting is that I used unlikely() to try to discourage the compiler from inlining RelationBuildPartitionDesc into RelationGetPartitionDesc (and likewise for the Key functions). Not sure how effective that is, but it can't hurt. I haven't removed equalPartitionDescs here; that seems like material for a separate patch (to make it easier to put it back if we need it). regards, tom lane
Commits
-
Fix CheckAttributeType's handling of collations for ranges.
- f521ef0ae319 9.4.26 landed
- de3d2df75169 10.12 landed
- 74b35eb468dc 13.0 landed
- 742c646c1987 9.6.17 landed
- 65aa155135a5 12.2 landed
- 59047b6d0c93 9.5.21 landed
- 25dc267a1be5 11.7 landed
-
Improve comments in utils/rel.h.
- fbe0232358c1 13.0 landed
-
Allow whole-row Vars to be used in partitioning expressions.
- bb4114a4e2c6 13.0 landed
-
Remove equalPartitionDescs().
- 42f74f49367b 13.0 landed
-
Load relcache entries' partitioning data on-demand, not immediately.
- 5b9312378e2f 13.0 landed
-
Disallow partition key expressions that return pseudo-types.
- ea1205a02a03 10.12 landed
- 7fbb39a967ea 12.2 landed
- 281dd22ac015 11.7 landed
- 39ebb943de9d 13.0 landed
-
Prevent a rowtype from being included in itself via a range.
- 6609c3ad984b 9.5.21 landed
- 4af2531d0393 10.12 landed
- 354d913f9745 9.6.17 landed
- 31dfa40a8341 11.7 landed
- 0d245d13c643 9.4.26 landed
- fc7695891d35 13.0 landed
- 976cb11f6c58 12.2 landed