Another FK puzzle; generation order dependency?

From: Jim Menard (jim..o.com)
Date: Thu Dec 18 2003 - 15:31:11 EST

  • Next message: Tore Halset: "use cayenne to copy from one db to another"

    I have an album table with a nullable FK to photo (it's the optional
    "cover photo" of the album). The db relationship is defined in both
    directions as 1:1.

    The first time I generate the schema using the modeler, I see the
    dreaded error message

    Schema Generation Error: Failed statement: ALTER TABLE public.photo ADD
    FOREIGN KEY (id) REFERENCES public.album (cover_photo_id) - ERROR:
    UNIQUE constraint matching given keys for refenced table "album" not
    found.

    Something else is weird, though. With sufficient poking and prodding, I
    can make it work without the error message. Specifically, if I
    separately

    1) drop all tables and PK support
    2) create tables only, no FK support
    3) create FK support
    4) create PK support

    it works.

    Could this be an order dependency problem? Am I doing something wrong
    (again)?

    Jim

    -- 
    Jim Menard, jim..o.com, http://www.io.com/~jimm/
    "My parents just came back from a planet where the dominant lifeform
    had no bilateral symmetry, and all I got was this stupid F-Shirt."
         -- .sig of Paul Archer
    



    This archive was generated by hypermail 2.0.0 : Thu Dec 18 2003 - 15:31:16 EST