Skip site navigation (1) Skip section navigation (2)

Re: CREATE TABLE LIKE INCLUDING INDEXES support

From: Neil Conway <neilc(at)samurai(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Trevor Hardcastle <chizu(at)spicious(dot)com>, NikhilS <nikkhils(at)gmail(dot)com>, pgsql-patches(at)postgresql(dot)org
Subject: Re: CREATE TABLE LIKE INCLUDING INDEXES support
Date: 2007-04-27 22:59:10
Message-ID: 1177714750.6440.160.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
This patch needs more work. How carefully did you test it?

* the patch failed to copy index constraints if there was not also at
least one CHECK constraint defined on the table

* the patch is broken for expressional indexes, and silently omits
copying the predicate that may be associated with an index. It also
doesn't copy the index's amoptions (WITH clause), or the NULLS
FIRST/etc. options that may be associated with any of the index's
columns.

In other words, copying column names does not suffice to duplicate the
index constraint. Perhaps the right fix is to implement support for
INCLUDING INDEXES, and then use that code to copy the definition of any
constraint indexes in INCLUDING INDEXES?

* should we copy invalid indexes? I suppose there's nothing wrong with
copying them...

* we should probably hold the AccessShareLock on copied indexes till end
of xact, per the comments at the end of transformInhRelation()

* index_open() should be matched with index_close(), not
relation_close(). (In the current implementation, index_close() and
relation_close() happen to be identical, so it still worked.)

I've attached a revised version of the patch, but I didn't fix the
second or third bullets in the list.

-Neil


Attachment: including_constraints_idx-2.patch
Description: text/x-patch (10.0 KB)

In response to

Responses

pgsql-hackers by date

Next:From: rancpine cuiDate: 2007-04-28 00:58:31
Subject: Re: Fwd: How does the partitioned lock manager works?
Previous:From: Tom LaneDate: 2007-04-27 22:06:35
Subject: Re: BUG #3244: problem with PREPARE

pgsql-patches by date

Next:From: Neil ConwayDate: 2007-04-28 22:41:26
Subject: Re: Hash function for numeric (WIP)
Previous:From: Jim NasbyDate: 2007-04-27 17:33:06
Subject: Re: too much WAL volume

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group