Thread

  1. Bug about 'Foreign Key'

    Cid R Andrade <crandrade@opeco.com.br> — 2001-03-27T14:43:32Z

    PostgreSQL Developers,
    
    I have a PostgreSQL 7.0.2 running at Conectiva Linux, with kernel 2.2.14, with 56 Mb of data.
    
    I'd created a table:
    Create Table Andamento (
        Etiqueta integer not null,
        CodTecnico integer not null,
        DtInicio timestamp not null,
        DtLiberacao timestamp null,
        Primary Key (Etiqueta),
        Foreign Key (Etiquetas) References Etiquetas (Etiqueta) On Delete Cascade)
                         
    I wrong a field name in Foreign Key declaration, and PostgreSQL created it!
    Before this, I always named triggers and constraints, but, at this time, I'd tried this way.
    Well, look the trigger at table Etiquetas:
    CREATE CONSTRAINT TRIGGER "<unnamed>" AFTER DELETE ON "etiquetas"  NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE "RI_FKey_noaction_del" ('<unnamed>', 'andamento', 'etiquetas', 'UNSPECIFIED', 'etiquetas', 'etiqueta');
    
    It says exists a field named etiquetas at table Andamento.
    I'd droped table andamento (Drop Table Andamento) and the trigger referencing it didn't droped.
    
    I solved it with pg_dump.
    
  2. Re: Bug about 'Foreign Key'

    Stephan Szabo <sszabo@megazone23.bigpanda.com> — 2001-03-27T16:29:30Z

    This should be fixed for 7.1, it now checks that the
    referencing columns exist on the fk table and that the
    referenced columns are part of a unique index
    [our unique/pkey] on the referenced table.
    
    On Tue, 27 Mar 2001, Cid R Andrade wrote:
    
    > PostgreSQL Developers,
    > 
    > I have a PostgreSQL 7.0.2 running at Conectiva Linux, with kernel 2.2.14, with 56 Mb of data.
    > 
    > I'd created a table:
    > Create Table Andamento (
    >     Etiqueta integer not null,
    >     CodTecnico integer not null,
    >     DtInicio timestamp not null,
    >     DtLiberacao timestamp null,
    >     Primary Key (Etiqueta),
    >     Foreign Key (Etiquetas) References Etiquetas (Etiqueta) On Delete Cascade)
    >                      I wrong a field name in Foreign Key declaration,
    > and PostgreSQL created it! Before this, I always named triggers and
    > constraints, but, at this time, I'd tried this way. Well, look the
    > trigger at table Etiquetas: CREATE CONSTRAINT TRIGGER "<unnamed>"
    > AFTER DELETE ON "etiquetas"  NOT DEFERRABLE INITIALLY IMMEDIATE FOR
    > EACH ROW EXECUTE PROCEDURE "RI_FKey_noaction_del" ('<unnamed>',
    > 'andamento', 'etiquetas', 'UNSPECIFIED', 'etiquetas', 'etiqueta');
    > 
    > It says exists a field named etiquetas at table Andamento.
    > I'd droped table andamento (Drop Table Andamento) and the trigger referencing it didn't droped.
    > 
    > I solved it with pg_dump.
    >