Re: Partitioned index can be not dumped

2021-07-01 Thread Álvaro Herrera
On 2021-Jun-30, Alexander Pyhalov wrote: > Looks good. It seems this comment refers to line 455. Ah, so it does. I realized that we don't need to do vac_open_indexes for partitioned tables: it is sufficient to know whether there are any indexes at all. So I replaced that with RelationGetIndexLis

Re: Partitioned index can be not dumped

2021-06-30 Thread Álvaro Herrera
On 2021-Jun-30, Zhihong Yu wrote: > Hi, > In that case, I wonder whether nindexes can be negated following the call > to vac_open_indexes(). > > vac_open_indexes(onerel, AccessShareLock, &nindexes, &Irel); > + nindexes = -nindexes; > > That way, hasindex can be dropped. > vac_updat

Re: Partitioned index can be not dumped

2021-06-30 Thread Zhihong Yu
On Wed, Jun 30, 2021 at 2:32 PM Álvaro Herrera wrote: > On 2021-Jun-30, Zhihong Yu wrote: > > > Hi, > > nit: > > - if (hasindex) > > + if (nindexes > 0) > > > > It seems hasindex is no longer needed since nindexes is checked. > > It's still used to call vac_update_relstats(). We want

Re: Partitioned index can be not dumped

2021-06-30 Thread Álvaro Herrera
On 2021-Jun-30, Zhihong Yu wrote: > Hi, > nit: > - if (hasindex) > + if (nindexes > 0) > > It seems hasindex is no longer needed since nindexes is checked. It's still used to call vac_update_relstats(). We want nindexes to be 0 for partitioned tables, but still pass true when there

Re: Partitioned index can be not dumped

2021-06-30 Thread Alexander Pyhalov
Álvaro Herrera писал 2021-06-30 21:54: On 2021-Jun-30, Alexander Pyhalov wrote: I've seen the following effect on PostgreSQL 14 stable branch. Index, created on partitioned table, disappears from pg_dump or psql \d output. This seems to begin after analyze. Partitoned relation relhasindex pg

Re: Partitioned index can be not dumped

2021-06-30 Thread Zhihong Yu
On Wed, Jun 30, 2021 at 11:54 AM Álvaro Herrera wrote: > On 2021-Jun-30, Alexander Pyhalov wrote: > > > I've seen the following effect on PostgreSQL 14 stable branch. > > Index, created on partitioned table, disappears from pg_dump or psql \d > > output. > > This seems to begin after analyze. Par

Re: Partitioned index can be not dumped

2021-06-30 Thread Álvaro Herrera
On 2021-Jun-30, Alexander Pyhalov wrote: > I've seen the following effect on PostgreSQL 14 stable branch. > Index, created on partitioned table, disappears from pg_dump or psql \d > output. > This seems to begin after analyze. Partitoned relation relhasindex pg_class > field suddenly becomes false

Re: Partitioned index can be not dumped

2021-06-30 Thread Álvaro Herrera
On 2021-Jun-30, Alexander Pyhalov wrote: > Hi. > > I've seen the following effect on PostgreSQL 14 stable branch. > Index, created on partitioned table, disappears from pg_dump or psql \d > output. > This seems to begin after analyze. Partitoned relation relhasindex pg_class > field suddenly beco

Re: Partitioned index can be not dumped

2021-06-30 Thread Alexander Pyhalov
Alexander Pyhalov писал 2021-06-30 17:26: Hi. Sorry, test had an issue. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 2aabf5e8e86d222e6a73b25ccc652fe645e12fc4 Mon Sep 17 00:00:00 2001 From: Alexander Pyhalov Date: Wed, 30 Jun 2021 17:22:37 +0300 Subject: [PATCH] Set relhasin

Partitioned index can be not dumped

2021-06-30 Thread Alexander Pyhalov
Hi. I've seen the following effect on PostgreSQL 14 stable branch. Index, created on partitioned table, disappears from pg_dump or psql \d output. This seems to begin after analyze. Partitoned relation relhasindex pg_class field suddenly becomes false. The issue happens after commit 0e69f705