Re: [PATCHES] Inherited Constraints

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Hannu Krosing <hannu(at)skype(dot)net>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Inherited Constraints
Date: 2005-12-08 17:49:48
Message-ID: 1134064188.63851.123.camel@home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> Another nice (but no doubt more complex) thing would be ability to add
> multiple constraints at once, needing only one seqscan to check for
> compliance with added constraints and/or making constraint checks
> smarter, so that for.ex. "ADD CONSTRAINT CHECK i > 0" could make use of
> index on i instead of doing a seqscan. Or if there is a constraint
> "CHECK i > 0" then adding another like "CHECK i > -1" would not need to
> check actual data either.

Check out the comma in alter table.

ALTER TABLE tab ADD COLUMN serial NOT NULL UNIQUE,
ADD CHECK (foo > 24),
ADD CHECK (baz < 18),
ADD COLUMN integer NOT NULL DEFAULT 32;

Table tab (and each of the tables that inherits from it) is scanned and
rewritten once.

I believe this was added for 8.0.

--

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-12-08 17:50:35 bgwriter leaks resources after errors
Previous Message Tom Lane 2005-12-08 17:36:30 Re: Reducing contention for the LockMgrLock

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2005-12-08 17:51:12 Re: problem in MS-VC6 environment.
Previous Message Hannu Krosing 2005-12-08 17:15:01 Re: [PATCHES] Inherited Constraints