richard coleman <rcoleman.ascentgl@xxxxxxxxx> writes: > Why doesn't ALTER TABLE ... ADD CONSTRAINT not come with an ALTER TABLE > ... ADD CONSTRAINT IF NOT EXISTS variant? There's a general allergy in this project to CREATE IF NOT EXISTS, because it's a foot-gun. If the command succeeds, you know that an object (constraint or whatever) by that name exists, but you have no right to assume anything whatsoever about its properties. CREATE OR REPLACE semantics are a lot less squishy. Would a command of that form solve your problem? (I'm not sure about a pleasing way to write that within ALTER TABLE, but this gripe is about semantics not syntax.) regards, tom lane