Re: Some RELKIND macro refactoring

2021-12-03 Thread Peter Eisentraut
On 23.11.21 16:09, Alvaro Herrera wrote: In init_fork(), there's a typo: +* For tables, the AM callback creates both the main and the init fork. should read: +* For tables, the AM callback creates both the main and the init forks. I believe the original wording is correct. Ov

Re: Some RELKIND macro refactoring

2021-12-02 Thread Peter Eisentraut
On 24.11.21 05:20, Michael Paquier wrote: On Mon, Nov 22, 2021 at 11:21:52AM +0100, Peter Eisentraut wrote: On 19.11.21 08:31, Michael Paquier wrote: Regarding 0001, I find the existing code a bit more self-documenting if we keep those checks flagInhAttrs() and guessConstraintInheritance(). So

Re: Some RELKIND macro refactoring

2021-11-23 Thread Michael Paquier
On Mon, Nov 22, 2021 at 11:21:52AM +0100, Peter Eisentraut wrote: > On 19.11.21 08:31, Michael Paquier wrote: >> Regarding 0001, I find the existing code a bit more self-documenting >> if we keep those checks flagInhAttrs() and guessConstraintInheritance(). >> So I would rather leave these. > > In

Re: Some RELKIND macro refactoring

2021-11-23 Thread Alvaro Herrera
On 2021-Nov-23, Alvaro Herrera wrote: > On 2021-Nov-22, Peter Eisentraut wrote: > > > Maybe > > > > else > > { > > Assert(RELKIND_HAS_STORAGE(rel->rd_rel->relkind); > > RelationCreateStorage(rel->rd_node, relpersistence); > > } > > > > create_storage is set earlier b

Re: Some RELKIND macro refactoring

2021-11-23 Thread Alvaro Herrera
On 2021-Nov-22, Peter Eisentraut wrote: > Maybe > > else > { > Assert(RELKIND_HAS_STORAGE(rel->rd_rel->relkind); > RelationCreateStorage(rel->rd_node, relpersistence); > } > > create_storage is set earlier based on RELKIND_HAS_STORAGE(), so this would > be consistent.

Re: Some RELKIND macro refactoring

2021-11-23 Thread Alvaro Herrera
On 2021-Nov-19, Michael Paquier wrote: > I think that you should keep this block as it is now. The part where > a relkind does not support table AMs and does not require storage > would get uncovered, and this new code would just attempt to create > storage, so it seems to me that the existing co

Re: Some RELKIND macro refactoring

2021-11-22 Thread Peter Eisentraut
On 19.11.21 08:31, Michael Paquier wrote: On Mon, Nov 01, 2021 at 07:28:16AM +0100, Peter Eisentraut wrote: Small rebase of this patch set. Regarding 0001, I find the existing code a bit more self-documenting if we keep those checks flagInhAttrs() and guessConstraintInheritance(). So I would

Re: Some RELKIND macro refactoring

2021-11-18 Thread Michael Paquier
On Mon, Nov 01, 2021 at 07:28:16AM +0100, Peter Eisentraut wrote: > > Small rebase of this patch set. Regarding 0001, I find the existing code a bit more self-documenting if we keep those checks flagInhAttrs() and guessConstraintInheritance(). So I would rather leave these. I like 0002, which ma

Re: Some RELKIND macro refactoring

2021-10-31 Thread Peter Eisentraut
aut Date: Mon, 30 Aug 2021 10:09:50 +0200 Subject: [PATCH v3 2/2] Some RELKIND macro refactoring Add more macros to group some RELKIND_* macros: - RELKIND_HAS_PARTITIONS() - RELKIND_HAS_TABLESPACE() - RELKIND_HAS_TABLE_AM() Discussion: https://www.postgresql.org/message-id/flat/a574c8f1-9c84-93ad

Re: Some RELKIND macro refactoring

2021-08-30 Thread Peter Eisentraut
ntinue; - - /* Don't bother computing anything for non-target tables, either */ + /* Don't bother computing anything for non-target tables */ if (!(tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION)) continue; -- 2.33.0 From 9fc

Re: Some RELKIND macro refactoring

2021-08-25 Thread Alvaro Herrera
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 attach

Re: Some RELKIND macro refactoring

2021-08-24 Thread Michael Paquier
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. Right. This maps with RELKIND_HAS_ST

Re: Some RELKIND macro refactoring

2021-08-24 Thread Peter Eisentraut
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. From 652d10eaf00aafb91c6f60149b04be90a33e5acb Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 2

Re: Some RELKIND macro refactoring

2021-08-16 Thread Michael Paquier
On Mon, Aug 16, 2021 at 10:22:50AM -0400, Alvaro Herrera wrote: > Partitioned tables are not listed here, but IIRC there's a patch to let > partitioned tables have a table AM so that their partitions inherit it. This was raised in the thread for ALTER TABLE SET ACCESS METHOD (see patch 0002): http

Re: Some RELKIND macro refactoring

2021-08-16 Thread Alvaro Herrera
On 2021-Aug-16, Peter Eisentraut wrote: > + if (rel->rd_rel->relkind == RELKIND_INDEX || > + rel->rd_rel->relkind == RELKIND_SEQUENCE) > + RelationCreateStorage(rel->rd_node, relpersistence); > + else if (RELKIND_HAS_TABLE_AM(rel->rd_

Some RELKIND macro refactoring

2021-08-16 Thread Peter Eisentraut
info->dobj.dump & DUMP_COMPONENT_DEFINITION)) continue; -- 2.32.0 From 0656f3959518bfa1bd03e8bea3028ccf69b1edad Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 16 Aug 2021 14:30:26 +0200 Subject: [PATCH v1 2/2] Some RELKIND macro refactoring Add more macros to grou