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

Re: BUG #3774: create table like including index doesn't update pg_constraints with primary key

From: NikhilS <nikkhils(at)gmail(dot)com>
To: ioguix(at)free(dot)fr
Cc: pgsql-bugs(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #3774: create table like including index doesn't update pg_constraints with primary key
Date: 2007-11-30 07:44:53
Message-ID: d3c4af540711292344i392ff67fw5fdc6d8faae2ddb1@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
Hi,


>
> The following bug has been logged online:
>
> Bug reference:      3774
> Logged by:          guillaume (ioguix) de Rorthais
> Email address:      ioguix(at)free(dot)fr
> PostgreSQL version: 8.3 beta3
> Operating system:   mac os x 10.4.10
> Description:        create table like including index doesn't update
> pg_constraints with primary key
> Details:
>
> When creating a table using the "create table ... (like ... inluding
> indexes...)" syntaxe, pg_catalog.pg_constraint is not updated with the PK
> constraints which actually is setted in pg_index.
>
> I'm not sure if this issue is actually a bug or if there a logic behind
> this, but as the primary key is a constraint, I would expect it to be
> setted
> in pg_constraint, shouldn't it ?
>

This can be handled by setting index->isconstraint appropriately inside
generateClonedIndexStmt().

The fundamental question though is should we allow primary, unique
CONSTRAINTS which use the index mechanism just as an implementation to be
created using the "INCLUDING INDEXES" mechanism.

As per the discussion here:

http://www.nabble.com/Re%3A-CREATE-TABLE-LIKE-INCLUDING-INDEXES-support-p10683716.html

maybe we should not?

In other words "INCLUDING INDEXES" should only create those indexes which do
not have isconstraint set to TRUE.

Comments?

Regards,
Nikhils
-- 
EnterpriseDB               http://www.enterprisedb.com

In response to

Responses

pgsql-hackers by date

Next:From: Brendan JurdDate: 2007-11-30 09:14:14
Subject: Re: [GENERAL] Empty arrays with ARRAY[]
Previous:From: Simon RiggsDate: 2007-11-30 06:31:33
Subject: Release Note Changes

pgsql-bugs by date

Next:From: MichailasDate: 2007-11-30 09:18:23
Subject: BUG #3791: Bug in aritmethic calculations
Previous:From: Mike C.Date: 2007-11-30 01:05:35
Subject: BUG #3790: pg_restore error canceling statement due to user request

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