Reputation: 19
what are the possibilities for this error to exist?
or solutions?
SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into jfmg_inventario
(nome
, data
, ficheiro
) values (hhhh, 2020-06-27, 96dbe622ec757cbb042d8605172432ff47e777f4.pdf))
Upvotes: 0
Views: 2444
Reputation: 1269563
You have provided no value for id
in the insert
statement. Hence, the database has to assign one itself.
But, id
would appear to be declared not null
, so NULL
can't be assigned. And there is no default value or generator for the column. Typically, an id
would be auto-generated somehow with an incremental value. In standard SQL, the declaration would look like:
id int generated always as identity primary key,
Upvotes: 1