title: PostgreSQL foreign key create error
body: <p>I'm new to PostgreSQL and trying to create table with foreign keys.But I got error below.</p>
  
  <pre><code>create table User_Role 
  ( 
      RoleId serial primary key not null, 
      RoleCode varchar(21), 
      Rolename varchar(30), 
      isActive bool 
  ) 
  
  CREATE TABLE User_Account( 
      UserId  serial primary key not null,
      RoleId_ref int REFERENCES User_Role (RoleId) NULL, 
      Username text NULL, 
      Password text NULL,  
      IsActive bool NULL 
  ) 
  
  CREATE TABLE User_Profile( 
      ProfileId  serial primary key not null, 
      UserId_ref int REFERENCES User_Account (UserId) NULL,
      RoleId_ref int REFERENCES User_Role (RoleId) NULL,
      FirstName Text NULL, 
      LastName  Text NULL, 
      Address   Text NULL,
      City  varchar(100) NULL   
  )
  </code></pre>
  
  <p>first two table created successfully. But last table occur create error.</p>
  
  <blockquote>
    <p>ERROR:  column "roleid" referenced in foreign key constraint does not exist
    SQL state: 42703</p>
  </blockquote>
  
  <p>but I can't understand why.</p>