pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Set pg_class.relhassubclass for partitioned indexes
8+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2018-10-22 d5845b283d  Fix description of pg_class.relispartition in documentation
  2018-10-22 55853d666c  Clarify descriptions of relhassubclass and relispartition in pg_class
* pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 02:07  Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 8+ messages in thread

From: Michael Paquier @ 2018-10-22 02:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Set pg_class.relhassubclass for partitioned indexes

Like for relations, switching this parameter is optimistic by turning it
on each time a partitioned index gains a partition.  So seeing this
parameter set to true means that the partitioned index has or has had
partitions.  The flag cannot be reset yet for partitioned indexes, which
is something not obvious anyway as partitioned relations exist to have
partitions.

This allows to track more conveniently partition trees for indexes,
which will come in use with an upcoming patch helping in listing
partition trees with an SQL-callable function.

Author: Amit Langote
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/80306490-b5fc-ea34-4427-f29c52156052@lab.ntt.co.jp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/17f206fbc824d2b4b14480199ca9ff7dea417eda

Modified Files
--------------
src/backend/catalog/index.c            |  5 ++-
src/backend/commands/indexcmds.c       |  4 +++
src/test/regress/expected/indexing.out | 56 +++++++++++++++++++++++-----------
src/test/regress/sql/indexing.sql      | 18 +++++++++--
4 files changed, 62 insertions(+), 21 deletions(-)



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 02:59  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 2 replies; 8+ messages in thread

From: Tom Lane @ 2018-10-22 02:59 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org

Michael Paquier <michael@paquier.xyz> writes:
> Set pg_class.relhassubclass for partitioned indexes

Seems like this commit should have touched the catalogs.sgml description
for that column, as well as the pg_class.h comment for it.  Neither of
those are worded in a way that suggests it could be set for non-table
relations.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 03:09  Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 8+ messages in thread

From: Amit Langote @ 2018-10-22 03:09 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org

On 2018/10/22 11:59, Tom Lane wrote:
> Michael Paquier <michael@paquier.xyz> writes:
>> Set pg_class.relhassubclass for partitioned indexes
> 
> Seems like this commit should have touched the catalogs.sgml description
> for that column, as well as the pg_class.h comment for it.  Neither of
> those are worded in a way that suggests it could be set for non-table
> relations.

Oops, sorry.

Attached fixes catalog.sgml to say table or index instead of just table.

As for pg_class.h, changing just the following line might seem odd, as
along with the surrounding lines, maybe this really says, "relation has..."

    bool        relhassubclass; /* has (or has had) derived classes */

Thanks,
Amit

Attachments:

relhassubclass-doc.patch (text/plain, 595B) download diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 6d6fbecd12..490145ca30 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1900,7 +1900,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l <entry><structfield>relhassubclass</structfield></entry> <entry><type>bool</type></entry> <entry></entry> - <entry>True if table has (or once had) any inheritance children</entry> + <entry>True if table or index has (or once had) any inheritance children</entry> </row> <row>
^ permalink raw reply [nested|flat] 8+ messages in thread

* Re: pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 03:12  Michael Paquier <michael@paquier.xyz>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 8+ messages in thread

From: Michael Paquier @ 2018-10-22 03:12 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org

On Sun, Oct 21, 2018 at 10:59:27PM -0400, Tom Lane wrote:
> Michael Paquier <michael@paquier.xyz> writes:
>> Set pg_class.relhassubclass for partitioned indexes
> 
> Seems like this commit should have touched the catalogs.sgml description
> for that column, as well as the pg_class.h comment for it.  Neither of
> those are worded in a way that suggests it could be set for non-table
> relations.

The pg_class.h comment looked fine for me first.  How would you reword
it?

relispartition tells "True if table is a partition", which is not
actually true as it can apply to indexes.  So this should be changed in
v11 as well, no?

For relhassubclass, perhaps we could do a bit more than just referring
to children...  What about the following:
"True if relation has (or once had) any inheritance children or
partitions"
Here is the current formulation:
"True if table has (or once had) any inheritance children"

And this should be changed in v10~ additionally?
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 03:20  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2018-10-22 03:20 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers@lists.postgresql.org

Michael Paquier <michael@paquier.xyz> writes:
> On Sun, Oct 21, 2018 at 10:59:27PM -0400, Tom Lane wrote:
>> Seems like this commit should have touched the catalogs.sgml description
>> for that column, as well as the pg_class.h comment for it.  Neither of
>> those are worded in a way that suggests it could be set for non-table
>> relations.

> The pg_class.h comment looked fine for me first.  How would you reword
> it?

Well, the question is what "derived class" means, but I'd tend to think
it means something that has an associated composite type; which indexes
do not.  So maybe instead of "has (or has had) derived classes", we could
write "has (or has had) child tables or indexes"?  I'm not wedded to
particular wording for this, but I think what's there now is a bit
misleading.

> relispartition tells "True if table is a partition", which is not
> actually true as it can apply to indexes.  So this should be changed in
> v11 as well, no?

Good point, that column's description is obsolete as well.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 04:35  Michael Paquier <michael@paquier.xyz>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: Michael Paquier @ 2018-10-22 04:35 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>; +Cc: pgsql-committers@lists.postgresql.org

On Sun, Oct 21, 2018 at 11:20:04PM -0400, Tom Lane wrote:
> Michael Paquier <michael@paquier.xyz> writes:
>> On Sun, Oct 21, 2018 at 10:59:27PM -0400, Tom Lane wrote:
>>> Seems like this commit should have touched the catalogs.sgml description
>>> for that column, as well as the pg_class.h comment for it.  Neither of
>>> those are worded in a way that suggests it could be set for non-table
>>> relations.
> 
>> The pg_class.h comment looked fine for me first.  How would you reword
>> it?
> 
> Well, the question is what "derived class" means, but I'd tend to think
> it means something that has an associated composite type; which indexes
> do not.  So maybe instead of "has (or has had) derived classes", we could
> write "has (or has had) child tables or indexes"?  I'm not wedded to
> particular wording for this, but I think what's there now is a bit
> misleading.

Your suggestion looks good to me.

>> relispartition tells "True if table is a partition", which is not
>> actually true as it can apply to indexes.  So this should be changed in
>> v11 as well, no?
> 
> Good point, that column's description is obsolete as well.

Amit, Tom, what do you think about the attached?  This merges all the
things proposed.
--
Michael

Attachments:

partition-docs-v2.patch (text/x-diff, 1.7K) download diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index 6d6fbecd12..9edba96fab 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -1900,7 +1900,9 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l <entry><structfield>relhassubclass</structfield></entry> <entry><type>bool</type></entry> <entry></entry> - <entry>True if table has (or once had) any inheritance children</entry> + <entry> + True if table or index has (or once had) any inheritance children + </entry> </row> <row> @@ -1948,7 +1950,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l <entry><structfield>relispartition</structfield></entry> <entry><type>bool</type></entry> <entry></entry> - <entry>True if table is a partition</entry> + <entry>True if table or index is a partition</entry> </row> <row> diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index dc6c415c58..788d7a31dc 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -60,7 +60,7 @@ CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,Relat bool relhasoids; /* T if we generate OIDs for rows of rel */ bool relhasrules; /* has (or has had) any rules */ bool relhastriggers; /* has (or has had) any TRIGGERs */ - bool relhassubclass; /* has (or has had) derived classes */ + bool relhassubclass; /* has (or has had) child tables or indexes */ bool relrowsecurity; /* row security is enabled or not */ bool relforcerowsecurity; /* row security forced for owners or * not */
signature.asc (application/pgp-signature, 832B) download ^ permalink raw reply [nested|flat] 8+ messages in thread

* Re: pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 04:46  Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 8+ messages in thread

From: Amit Langote @ 2018-10-22 04:46 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org

On 2018/10/22 13:35, Michael Paquier wrote:
> Amit, Tom, what do you think about the attached?  This merges all the
> things proposed.

Thanks, looks good to me.

Regards,
Amit





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgsql: Set pg_class.relhassubclass for partitioned indexes
@ 2018-10-22 06:40  Michael Paquier <michael@paquier.xyz>
  parent: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
  0 siblings, 0 replies; 8+ messages in thread

From: Michael Paquier @ 2018-10-22 06:40 UTC (permalink / raw)
  To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers@lists.postgresql.org

On Mon, Oct 22, 2018 at 01:46:49PM +0900, Amit Langote wrote:
> On 2018/10/22 13:35, Michael Paquier wrote:
>> Amit, Tom, what do you think about the attached?  This merges all the
>> things proposed.
> 
> Thanks, looks good to me.

Committed, and back-patched the part about relispartition to v11.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2018-10-22 06:40 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22 02:07 pgsql: Set pg_class.relhassubclass for partitioned indexes Michael Paquier <michael@paquier.xyz>
2018-10-22 02:59 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-10-22 03:09   ` Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
2018-10-22 03:12   ` Michael Paquier <michael@paquier.xyz>
2018-10-22 03:20     ` Tom Lane <tgl@sss.pgh.pa.us>
2018-10-22 04:35       ` Michael Paquier <michael@paquier.xyz>
2018-10-22 04:46         ` Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
2018-10-22 06:40           ` Michael Paquier <michael@paquier.xyz>

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