reset password
Author Message
victormejia
Posts: 40
Posted 19:22 Oct 21, 2010 |

I'm creating insert statements to the files table, but when I try to run

csns-test-insert.sql  I get this error.

ERROR: insert or update on table "files" violates foreign key constraint "files_owner_id_fkey"
SQL state: 23503
Detail: Key (owner_id)=(1100001) is not present in table "users".

However, if I run that sql file, and then put my insert statements in another sql file and run it, it's fine. Any tips?
 

Phobe
Posts: 40
Posted 19:28 Oct 21, 2010 |

It looks like you're trying to populate the 'File' table before the 'Users' table is populated. Check the order of the statements.

HuanXue
Posts: 34
Posted 22:32 Oct 21, 2010 |

Maybe you run this insert before the table 'users' create this user's0001'?