Re: CREATE TABLE LIKE INCLUDING INDEXES support

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Bruce Momjian" <bruce(at)momjian(dot)us>
Cc: "Trevor Hardcastle" <chizu(at)spicious(dot)com>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: CREATE TABLE LIKE INCLUDING INDEXES support
Date: 2007-04-05 03:25:52
Message-ID: 87mz1njydb.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Bruce Momjian" <bruce(at)momjian(dot)us> writes:

> Uh, shouldn't CREATE TABLE LIKE INCLUDING CONSTRAINTS already be including
> any indexes in the parent table?

You could argue it should for unique indexes since our unique indexes are how
we implement unique constraints. But I see no particular reason to expect it
to copy random other indexes. At least its name doesn't lead one to expect it
to.

I also thought it was sort of strange to have a command that otherwise is just
copying definitions suddenly start building whole new objects. I think I was
thinking it would be a long slow operation but I suppose creating an empty
index isn't really noticeably slow. It could print a NOTICE similar to what's
printed when you create a primary key or unique constraint.

It does mean that users would be unable to create a partition, load data, then
build indexes. Perhaps it would be nice to have an ALTER TABLE foo LIKE bar
INCLUDING CONSTRAINTS as well.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Postgres User 2007-04-05 03:47:40 Re: Using MS Access front-end with PG]
Previous Message Bruce Momjian 2007-04-05 03:08:15 Re: CREATE TABLE LIKE INCLUDING INDEXES support

Browse pgsql-patches by date

  From Date Subject
Next Message Zoltan Boszormenyi 2007-04-05 04:20:00 Re: IDENTITY/GENERATED v36 Re: Final version of IDENTITY/GENERATED patch
Previous Message Bruce Momjian 2007-04-05 03:08:15 Re: CREATE TABLE LIKE INCLUDING INDEXES support