Some RELKIND macro refactoring

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-08-16T13:20:07Z
Lists: pgsql-hackers

Attachments

Attached patches introduce more macros to group some RELKIND_* macros:

- RELKIND_HAS_PARTITIONS()
- RELKIND_HAS_TABLESPACE()
- RELKIND_HAS_TABLE_AM()
- RELKIND_HAS_INDEX_AM()

I collected those mainly while working on the relkind error messages 
patch [0].  I think they improve the self-documentation of the code in 
many places that are currently just random collections or endless 
streams of RELKIND macros.

Some may recall the previous thread [1] that made a similar proposal. 
The result here was that those macros were too thinly sliced and not 
generally useful enough.  My proposal is completely separate from that.


[0]: 
https://www.postgresql.org/message-id/flat/dc35a398-37d0-75ce-07ea-1dd71d98f8ec@2ndquadrant.com
[1]: 
https://www.postgresql.org/message-id/flat/CAFjFpRcfzs%2Byst6YBCseD_orEcDNuAr9GUTraZ5GC%3DAvCYh55Q%40mail.gmail.com

Commits

  1. Some RELKIND macro refactoring

  2. pg_dump: Add missing relkind case

  3. Fix handling of partitioned index in RelationGetNumberOfBlocksInFork()