title: POSTGRESQL. Insert or update on table violates foreign key constraint
body: <p>I am new in Posgresql. I have 5 tables and I am trying to INSERT properties to tables.  When I tried to Insert 2nd time, I have this error in 'pgadmin'. </p>
  
  <p><code>ERROR:  insert or update on table "question" violates foreign key constraint "question_id_difficulty_fkey" DETAIL:  Key (id_difficulty)=(9) is not present in table "difficulty". SQL state: 23503.</code></p>
  
  <p>my schema is here </p>
  
  <pre><code>  id SERIAL PRIMARY KEY,
    name varchar
  );
  
  CREATE TABLE question (
    id SERIAL PRIMARY KEY,
    text varchar,
    correct_answer varchar,
    incorrect_answer1 varchar,
    incorrect_answer2 varchar,
    incorrect_answer3 varchar,
    id_difficulty SERIAL REFERENCES difficulty(id),
    id_category SERIAL REFERENCES category (id),
    id_creator SERIAL REFERENCES game (id)
  );
  
  CREATE TABLE difficulty (
    id SERIAL PRIMARY KEY,
    name varchar
  );
  
  CREATE TABLE category (
    id SERIAL PRIAMRY KEY,
    name varchar
  );
  
  CREATE TABLE user (
    id SERIAL PRIMARY KEY,
    name varchar
  )
  
  
  </code></pre>