title: Wrong id generation with Postgres
body: <p>I am making a web app and as database provider I am using postgresql and Ef Core as ORM. I have two classes:</p>
  <pre><code>public class Price
  {
      public int PriceId { get; set; }
      public DateTime TimeStamp { get; set; }
      public double Value { get; set; }
      public int CompanyId { get; set; }
  
      public virtual Company Company { get; set; }
  }
  
  
  public class Company
      {
          public Company()
          {
              Prices = new HashSet&lt;Price&gt;();
          }
  
          public int CompanyId { get; set; }
          public string Acronym { get; set; }
          public string FullName { get; set; }
  
          public virtual ICollection&lt;Price&gt; Prices { get; set; }
      }
  </code></pre>
  <p>My issue is that whenever I am trying to add a few records for first company:</p>
  <pre><code>var company = Context.Companies.FirstOrDefault(c =&gt; c.CompanyId == 1);
  company.Prices.Add(new Price {Value = 123.45, TimeStamp = DateTime.Now});
  </code></pre>
  <p>and then for another</p>
  <pre><code>var company = Context.Companies.FirstOrDefault(c =&gt; c.CompanyId == 2);
  company.Prices.Add(new Price {Value = 123.45, TimeStamp = DateTime.Now});
  </code></pre>
  <p>instead of:</p>
  <pre><code>CompanyId | PriceId | TimeStamp | Value
  -------------------------------------------
  1 | 1 | foo | bar
  1 | 2 | foo | bar
  2 | 1 | foo | bar
  2 | 2 | foo | bar
  </code></pre>
  <p>I get:</p>
  <pre><code>CompanyId | PriceId | TimeStamp | Value
  -------------------------------------------
  1 | 1 | foo | bar
  1 | 2 | foo | bar
  2 | 3 | foo | bar
  2 | 4 | foo | bar
  </code></pre>
  <p>My Pgadmin 4 configuration:</p>
  <p><a href="https://i.stack.imgur.com/iUa55.png" rel="nofollow noreferrer">Companies table - CompanyId configuration</a></p>
  <p><a href="https://i.stack.imgur.com/RFe4F.png" rel="nofollow noreferrer">Prices table - CompanyId and PriceId configuration</a></p>