Answers.Body: <blockquote>
    <p>there's a sequence being created for entrydrafts but not for drafts.</p>
  </blockquote>
  
  <p>That's your issue.</p>
  
  <p>I did a fresh Craft 3.3. install on PostgreSQL and there should be a <code>drafts_id_seq</code> sequence created for the <code>drafts</code> table that you're missing.</p>
  
  <p><a href="https://i.sstatic.net/v7Uf5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/v7Uf5.png" alt="enter image description here"></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-28T23:47:01.027Z
Answers.Text: Thanks, Brad. I ended up nuking the entire environment and starting over. I had imported a database from a server running PostgreSQL 11 into a vagrant box running 9.6 - after importing into a new box running the same version everything seems to have sorted itself out. Thanks!
Answers.UserDisplayName: Sara King
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T22:27:25.070Z
Answers.LastActivityDate: 2019-08-27T22:27:25.070Z
Answers.UserDisplayName: Brad Bell
Body: <p>Looking for some help here - I'm working on a site that is using a PostgreSQL db and am running into an issue. When saving a large Matrix field with multiple block types I was receiving the following error:</p>
  
  <pre><code>Integrity constraint violation
  SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint
  </code></pre>
  
  <p>At first, I thought there was something corrupted with the Matrix so I nuked it and rebuilt it - everything seemed to be working fine until I created a new channel section - when I tried to create an entry there, I got the following error:</p>
  
  <pre><code>Integrity constraint violation
  SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint
  The SQL being executed was: INSERT INTO "drafts" ("sourceId", "creatorId", "name", "notes") VALUES (NULL, 5772, 'First draft', NULL)).
  </code></pre>
  
  <p>Similar to the above, just a new table this time. </p>
  
  <p>Everything I am reading points to an auto-increment issue, though in both cases there does seem to be the appropriate sequence in the db. I've barely used PostgreSQL and never with Craft, though I'm not 100% certain it has to do with the db. </p>
  
  <p>Any thoughts on what could be causing this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-20T23:03:48.170Z
Comments.Text: It definitely seems like that table is missing the sequence that creates the integers for the id column. If you do a database dump, do you see them in the output?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-21T13:45:51.717Z
Comments.Text: Brad, there's a sequence being created for entrydrafts but not for drafts. Also, while I'm not sure it matters, there are a few entries in the drafts table with NULL sourceId values.
Comments.UserDisplayName: Sara King
Tags: <postgresql>
Title: Integrity constraint violation - Not null violation
ThreadText: # Integrity constraint violation - Not null violation
  
  (Asked by: username_0 on 2019-08-20)
  
  Looking for some help here - I'm working on a site that is using a PostgreSQL db and am running into an issue. When saving a large Matrix field with multiple block types I was receiving the following error:
  
  ```
  Integrity constraint violation
  SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint
  
  ```
  
  At first, I thought there was something corrupted with the Matrix so I nuked it and rebuilt it - everything seemed to be working fine until I created a new channel section - when I tried to create an entry there, I got the following error:
  
  ```
  Integrity constraint violation
  SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" violates not-null constraint
  The SQL being executed was: INSERT INTO "drafts" ("sourceId", "creatorId", "name", "notes") VALUES (NULL, 5772, 'First draft', NULL)).
  
  ```
  
  Similar to the above, just a new table this time.
  
  Everything I am reading points to an auto-increment issue, though in both cases there does seem to be the appropriate sequence in the db. I've barely used PostgreSQL and never with Craft, though I'm not 100% certain it has to do with the db.
  
  Any thoughts on what could be causing this?
  
  **Tags:** postgresql
  
  > **Comments:**
  > **username_1**: It definitely seems like that table is missing the sequence that creates the integers for the id column. If you do a database dump, do you see them in the output?  
  > **username_0**: username_1, there's a sequence being created for entrydrafts but not for drafts. Also, while I'm not sure it matters, there are a few entries in the drafts table with NULL sourceId values.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-08-27. Score: 0
  
  > there's a sequence being created for entrydrafts but not for drafts.
  
  That's your issue.
  
  I did a fresh Craft 3.3. install on PostgreSQL and there should be a `drafts_id_seq` sequence created for the `drafts` table that you're missing.
  
  [![enter image description here](https://i.sstatic.net/v7Uf5.png)](https://i.sstatic.net/v7Uf5.png)
  
  > **Comments:**
  > **username_0**: Thanks, username_1. I ended up nuking the entire environment and starting over. I had imported a database from a server running PostgreSQL 11 into a vagrant box running 9.6 - after importing into a new box running the same version everything seems to have sorted itself out. Thanks!  
  
  ---
  
  