From: Trevor Hardcastle <chizu(at)spicious(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Date: 2007-03-07 03:06:29
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-patches

Greetings all,

I wrote this patch about a week ago to introduce myself to coding on
PostgreSQL. I wasn't entirely sure what the 'INCLUDING INDEXES' option
was meant to do, so I held off submitting it until I could get around to
asking about that and tweaking the documentation to reflect the patch.
By useful coincidence the thread "Auto creation of Partitions" had this
post in it, which made the intent of the option clear enough for me to
go ahead and see what people think of this.

Gregory Stark wrote:
> "NikhilS" <nikkhils(at)gmail(dot)com> writes:
>> the intention is to use this information from the parent and make it a
>> property of the child table. This will avoid the step for the user having to
>> manually specify CREATE INDEX and the likes on all the children tables
>> one-by-one.
> Missed the start of this thread. A while back I had intended to add WITH
> INDEXES to CREATE TABLE LIKE. That would let you create a tale LIKE parent
> WITH CONSTRAINTS WITH INDEXES and get pretty much a perfect table ready for
> adding to the inheritance structure.
So, that's what this patch does. When a table is created with 'CREATE
TABLE ... LIKE parent INCLUDING INDEXES' this iterates over the parent
table indexes looking for constraint indexes, and alters the
CreateStmtContext to include equivalent indexes on the child table.

This is probably a somewhat naive implementation, being a first attempt.
I wasn't sure what sort of lock to place on the parent indexes or what
tablespace the new indexes should be created in. Any help improving it
would be appreciated.

Thank you,
-Trevor Hardcastle

Attachment Content-Type Size
like_including_indexes.patch text/plain 8.6 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Luke Lonergan 2007-03-07 03:32:28 Re: Bug: Buffer cache is not scan resistant
Previous Message Sherry Moore 2007-03-07 03:05:09 Re: Bug: Buffer cache is not scan resistant

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-03-07 04:34:57 Re: Aggressive freezing in lazy-vacuum
Previous Message ITAGAKI Takahiro 2007-03-07 02:18:20 Re: Aggressive freezing in lazy-vacuum