ERROR: null value in column "id"


We are running in production Metabase 0.37.2, and I am in the process to update it to the latest version (0.40.1). I have created a separate environment (we are using AWS Beanstalk, with Postgres 11 over RDS). To clone Metabase application's DB I used AWS-DMS (over the same 0.37.2 version and I stopped the replication once all the data was migrated).

The process to update from 0.37.2 to 0.40.1 has been downloading all the single CE bundle files, and move the MB one version up at a time.

Now I have it working in 0.40.1, but when I try to create anything new (question, dashboard, pin...) I get an "ERROR: null value in column "id" violates not-null constraint". I manually altered report_card and report_dashboard to add an autoincrement to the id, and that enabled the saving questions and dashboards for me. But I have the same issue if I try to pin (or I don't know how many other features). Has anybody experienced something like this? how many tables would I have to alter to get it working? and, is there anything else broken I didn't see?

P.S. I found this in the forum (Add a DB to metabase (null value in column “id”)), but didn't really help :frowning:

Hi @t_deux
I'm not sure how you created the clone, but it sounds like you only copied the structure and data, not the constraints.
I would recommend that you use pg_dump to make a complete duplicate.
If you have some places in the application database that is suddenly changed, then you essentially have a corrupted application database, which can lead to many problems down the line.
If you need something to compare to, then setup a new instance of 0.40.1 and dump that database, so you can ensure that your clone looks identically.

1 Like

doh! so true. Thanks for the quick answer!