Re: WIP: generalized index constraints - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: WIP: generalized index constraints
Date
Msg-id 1250819347.10782.1284.camel@monkey-cat.sm.truviso.com
Whole thread Raw
In response to Re: WIP: generalized index constraints  (Brendan Jurd <direvus@gmail.com>)
Responses Re: WIP: generalized index constraints  (Brendan Jurd <direvus@gmail.com>)
List pgsql-hackers
On Fri, 2009-08-21 at 11:14 +1000, Brendan Jurd wrote:
> As an aside, Jeff, have you considered how this feature would interact
> with CREATE TABLE ... LIKE parent_table [ { INCLUDING | EXCLUDING } {
> DEFAULTS | CONSTRAINTS | INDEXES } ] ... }?  What if someone asks to
> include indexes but not constraints?  Vice-versa?  Will these cases be
> handled gracefully?

I hadn't considered that yet, thanks for bringing it to my attention.

>From the docs on CREATE TABLE (... LIKE ...):

"Not-null constraints are always copied to the new table. CHECK
constraints will only be copied if INCLUDING CONSTRAINTS is specified;
other types of constraints will never be copied."

If they include constraints and not indexes, nothing special.

If they include indexes and not constraints, I think we should follow
the same policy as unique constraints, and create the index and the
constraint.

The behavior seems a little strange to me, but that's the current
behavior for unique indexes.

Regards,Jeff Davis



pgsql-hackers by date:

Previous
From: Brendan Jurd
Date:
Subject: Re: WIP: generalized index constraints
Next
From: Brendan Jurd
Date:
Subject: Re: WIP: generalized index constraints