pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Koczan <pjkoczan@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Legacy foreign keys
Date: Mon, 10 Dec 2007 13:12:34 -0600
Message-ID: <4544e0330712101112r6aeccfcckef378a7ea1795e07@mail.gmail.com> (raw)

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 '<unnamed>' 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"('<unnamed>', '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"('<unnamed>',
'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



view thread (15+ messages)  latest in thread

Message-ID: <4544e0330712101112r6aeccfcckef378a7ea1795e07@mail.gmail.com>
Permalink:  ../4544e0330712101112r6aeccfcckef378a7ea1795e07@mail.gmail.com/
Also on:    postgresql.org/message-id/4544e0330712101112r6aeccfcckef378a7ea1795e07@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: pjkoczan@gmail.com
  Subject: Re: Legacy foreign keys
  In-Reply-To: <4544e0330712101112r6aeccfcckef378a7ea1795e07@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox