> 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. -- ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster