[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: First upgrade attempt from 1.2.21 -> 1.3.0RC4 == Fail



On Fri, Oct 7, 2011 at 12:17 PM,  <..hidden..> wrote:
>
>
> On Fri, 7 Oct 2011, ..hidden.. wrote:
>
>>
>> This time making it to
>>
>> INSERT INTO audittrail(trans_id, tablename, reference, formname, action,
>>             transdate, person_id, entry_id)
>>      SELECT trans_id, tablename, reference, formname, action,
>>             transdate, p.id, entry_id
>>        FROM lsmb12.audittrail a
>>        JOIN lsmb12.employee e ON a.employee_id = e.id
>>        JOIN person p on e.entity_id = p.entity_id;
>>
>> psql:sql/upgrade/1.2-1.3-manual.sql:582: ERROR:  insert or update on table
>> "audittrail" violates foreign key constraint "audittrail_person_id_fkey"
>> DETAIL:  Key (person_id)=(1) is not present in table "person".
>>
>
> It looks like either the contraint
>
>   "audittrail_person_id_fkey" FOREIGN KEY (person_id) REFERENCES person(entity_id)
>
> should be
>
>  "audittrail_person_id_fkey" FOREIGN KEY (person_id) REFERENCES
> person(id)
>
> OR
>
> the query should be
>
> INSERT INTO audittrail(trans_id, tablename, reference, formname, action,
>             transdate, person_id, entry_id)
>      SELECT trans_id, tablename, reference, formname, action,
>             transdate, p.entity_id, entry_id
>        FROM lsmb12.audittrail a
>        JOIN lsmb12.employee e ON a.employee_id = e.id
>        JOIN person p on e.entity_id = p.entity_id;
>
>
Thanks!  Changing the query and committing.

Would you like credit for help in the CONTRIBUTORS file?  If so, how
would you like your name to appear?  Would you like your email address
slightly obfuscated or redacted?

Best Wishes,
Chris Travers