Thread: CREATE TABLE ... INHERITS (parent INCLUDING xxx)

CREATE TABLE ... INHERITS (parent INCLUDING xxx)

From
Itagaki Takahiro
Date:
We have two ways to copy table definitions: - CREATE TABLE child ( LIKE parent ) - CREATE TABLE child ( ) INHERITS (
parent)
 

But "INCLUDING xxx" is supported only in "LIKE" version.
Should we have "INHERITS ( parent INCLUDING xxx )" syntax ?

We can use LIKE and INHERITS at once:   CREATE TABLE chld ( LIKE parent INCLUDING ALL ) INHERITS (parent)
but will have annoying log messages:   NOTICE:  merging column "..." with inherited definition

Since partitioning syntax are rewritten into INHERITS and INCLUDING ALL
internally, eliminating such logs will be better. CREATE TABLE LIKE +
ALTER TABLE INHERIT can solve the issue, but direct solutions are welcome.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center



Re: CREATE TABLE ... INHERITS (parent INCLUDING xxx)

From
Tom Lane
Date:
Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> Should we have "INHERITS ( parent INCLUDING xxx )" syntax ?

No.  That would imply that the user has some control over what is
inherited and what isn't, which would be a complete mess.
        regards, tom lane


Re: CREATE TABLE ... INHERITS (parent INCLUDING xxx)

From
Itagaki Takahiro
Date:
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> > Should we have "INHERITS ( parent INCLUDING xxx )" syntax ?
> 
> No.  That would imply that the user has some control over what is
> inherited and what isn't, which would be a complete mess.

Hmmm, but users can already control using LIKE INCLUDING clause what is
inherited and what isn't. Also, we don't inherit anything from INHERITS
clause in default. We have nothing to lose even if we support INHERITS
+ INCLUDING, no?  And there are certain merits; we can avoid unexpected
log messages and don't have to repeat the parent name in DDL.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center