auto primary key field
looks like the model.insert call is not making the primary key.  i have not intentionally passed in a primary key, also possible the record coming in has null on the primary key already and you are not overwriting that?  I am going to try .create instead of .insert Peewee has a convention of using `id` for an auto-incrementing primary key field. Perhaps you're subclassing models which override the primary key?

Can you provide example code I can use to reliably replicate this issue? Without that I'm a little at a loss how to replicate this or even verify there is a bug. Please comment with additional details or steps I can follow to replicate, and I will be happy to reopen and investigate. Hello,

Thanks for the help.

I have resolved this on my end.

Issue comes up if one has a postgres 9.6 version.   I moved to 10 postgres and it went away.
However, I also was more brutal in my code as related to ID generation and storage, and perhaps that also fixed the problem.

Eitherway I am in peewee 3x and looks to be working now.

Thanks!!!!
Evan

Sent with [ProtonMail](https://protonmail.com) Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On May 8, 2018 9:45 AM, Charles Leifer <notifications@github.com> wrote:

> Please comment with additional details or steps I can follow to replicate, and I will be happy to reopen and investigate.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, [view it on GitHub](https://github.com/coleifer/peewee/issues/1598#issuecomment-387407156), or [mute the thread](https://github.com/notifications/unsubscribe-auth/AXFzJlcgsNjM032U-b8jr-Y-ANUeknJIks5twaFjgaJpZM4T0FOF).
Using peewee 3.3.1 (just upgraded to 3.3.4).

Python
On ubuntu 16

"sometimes" I find a rather odd new error.

I have various classes which have foriegn keys etc,  some have no primary key defined.  Peewee defiens an auto increments the key on creation, or it has in the "past versions".  However, I now find that "sometimes" the auto increment of the primary key does not occur and it comes out as null in the insert and blows an error in sql.  Saying null value in colum n";id"; violates not-null constraint (postgres).

Then "failing row contains (null, ...)
statement is
insert into table ("foo_id", ..

and foo is the foreign table.

NOW, if i put int an autofield and explcitly deal with that then the problem goes away.

But would rather not rewrite my code, and would like to know what is up. 

Ideas?

Evan