Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix insert Entity object on postgres #3222

Merged

Conversation

MashinaMashina
Copy link
Contributor

@MashinaMashina MashinaMashina commented Jul 4, 2020

I add check that $data->{$primaryKey} is set, before add it to $data. Otherwise we get error on insert:

pg_query(): Query failed: ERROR: null value in column "id" violates not-null constraint

because sql:

INSERT INTO table (key, id) VALUES('value', NULL)

@michalsn michalsn merged commit ff6911e into codeigniter4:develop Jul 4, 2020
@michalsn
Copy link
Member

michalsn commented Jul 4, 2020

Good catch, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants