Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 5462B2E3026 for ; Mon, 10 Dec 2007 15:14:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 00289-01-10 for ; Mon, 10 Dec 2007 15:14:12 -0400 (AST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.180]) by postgresql.org (Postfix) with ESMTP id DE9EE2E2F83 for ; Mon, 10 Dec 2007 15:12:38 -0400 (AST) Received: by py-out-1112.google.com with SMTP id u77so103655pyb for ; Mon, 10 Dec 2007 11:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=7O+uR3wHbEi2DgoUnVB0ez3cnU82+gOGBn48nNbPf8E=; b=S6mLmzNhM37w/I6iOri4+pa0BgvoMmOnja6AISyNCkiBUfct7jY7ghhmpp2fRd7yVbRwFZl1sQBxmkcwWRQremrR1qr91+day2g7xvGh3raadsocq/oTt+LikfV5YpULBIHJou0dsJ/pAQnvcla8/g7xdQ+ZPqh087/F6AN1pUw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=T54cgjLXa17xKZUSj8fBTDKvU+3j9uHEnwdfInLAjIk4kyaNNwmz2DpjpNI7Y2ZuSVjaCbvl4ltaKD0uruBuQAnfKs8JbqOxAeY3DW5ikhWdfnnXx/xNZzQTo3o6J8Q7iWLycrIX0M5GwU5GLtE8okPhJpXY8G208t0jlV67U8U= Received: by 10.114.135.1 with SMTP id i1mr1015334wad.1197313954241; Mon, 10 Dec 2007 11:12:34 -0800 (PST) Received: by 10.114.199.9 with HTTP; Mon, 10 Dec 2007 11:12:34 -0800 (PST) Message-ID: <4544e0330712101112r6aeccfcckef378a7ea1795e07@mail.gmail.com> Date: Mon, 10 Dec 2007 13:12:34 -0600 From: "Peter Koczan" To: pgsql-admin@postgresql.org Subject: Legacy foreign keys MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/38 X-Sequence-Number: 27555 Hi all, I am having a problem with what appear to be legacy foreign keys in some of my databases (probably pre-7.2 days). They won't restore from 8.2 to 8.3, because the '' field in the called function isn't unique when I try to restore more than one of these legacy keys Here's an example => \d sushi.atom ...table definition, rules, etc.... Triggers: "RI_ConstraintTrigger_23125842" AFTER INSERT OR UPDATE ON sushi.atom FROM sushi.atom_type_values NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE "RI_FKey_check_ins"('', 'atom', 'atom_type_values', 'UNSPECIFIED', 'type', 'atom_type') "RI_ConstraintTrigger_23125843" AFTER INSERT OR UPDATE ON sushi.atom FROM sushi.state_values NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE "RI_FKey_check_ins"('', 'atom', 'state_values', 'UNSPECIFIED', 'state', 'state') While I could fix this, I figure this would be a good opportunity to quickly run alter table and get these keys in a not-ancient form. Does anyone know how to translate these to the modern form (including proper CASCADE and RESTRICT values so I can drop the trigger and add the proper foreign key? Thanks much. Peter