On Fri, Oct 7, 2011 at 12:17 PM,  <[email protected]> wrote:
>
>
> On Fri, 7 Oct 2011, [email protected] 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

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Ledger-smb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

Reply via email to