pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Some RELKIND macro refactoring
Date: Wed, 25 Aug 2021 09:31:46 -0400
Message-ID: <202108251331.6jfqss3vfrtv@alvherre.pgsql> (raw)
In-Reply-To: <YSXYuxLv+ed/Dy0v@paquier.xyz>

On 2021-Aug-25, Michael Paquier wrote:

> On Tue, Aug 24, 2021 at 12:01:33PM +0200, Peter Eisentraut wrote:
> > While analyzing this again, I think I found an existing mistake.  The
> > handling of RELKIND_PARTITIONED_INDEX in RelationGetNumberOfBlocksInFork()
> > seems to be misplaced.  See attached patch.

Agreed, that's a mistake.

> Right.  This maps with RELKIND_HAS_STORAGE().  Makes me wonder whether
> is would be better to add a check on RELKIND_HAS_STORAGE() in this
> area, even if that's basically the same as the Assert() already used
> in this code path.

Well, the patch replaces the switch on individual relkind values with if
tests on RELKIND_HAS_FOO macros.  I suppose we'd have

Assert(RELKIND_HAS_STORAGE(relkind));

so the function would not even be called for partitioned indexes. (In a
quick scan of 'git grep RelationGetNumberOfBlocks' I see nothing that
would obviously call this function on a partitioned index.)

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"XML!" Exclaimed C++.  "What are you doing here? You're not a programming
language."
"Tell that to the people who use me," said XML.
https://burningbird.net/the-parable-of-the-languages/





view thread (16+ messages)  latest in thread

Message-ID: <202108251331.6jfqss3vfrtv@alvherre.pgsql>
Permalink:  ../202108251331.6jfqss3vfrtv@alvherre.pgsql/
Also on:    postgresql.org/message-id/202108251331.6jfqss3vfrtv@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, michael@paquier.xyz, peter.eisentraut@enterprisedb.com
  Subject: Re: Some RELKIND macro refactoring
  In-Reply-To: <202108251331.6jfqss3vfrtv@alvherre.pgsql>
  References: <YSXYuxLv+ed/Dy0v@paquier.xyz> <202108251331.6jfqss3vfrtv@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox