Pkey restraint error

I am trying to allow a page I created to let users insert a record. I set up a GUI SQL using key value pairs. Now, when it runs, I get the following error " Insert into rp_shipped_2025 failed: you must satisfy the constraint 'Rp shipped 2025 pkey'

This error message has been driving me crazy for quite some time. Nobody seems to be able to explain what it means or how to fix it. I have an id field in the table which is auto-incrementing. At this point I have no idea what else to try.

Can someone please help here?

Now I am also getting a pkey error when trying to import data into a database.

Duplicate key value violates unique constraint "tp_shipped_2025_pkey"

These pkey errors are going to drive me crazy. Is there any way to fix them?

Which database are you using? How is the primary key constraint set up? Does the column have a default established?

Hey @tomm - I don't know if you're working on this project anymore, but wanted to reach out to see if you still needed any assistance.

Yes, I do still need assistance.

I have a Retool database called foam_tracking. I have created a form to allow people to enter data into that database. It worked for a while, but now all of sudden I am getting the following error:

"Insert into foam_tracking failed: you must satisfy the constraint 'Foam tracking pkey'"

My id field is a auto-incrementing integer ID. I really don't have any idea what this error means and I have no idea how to fix it. I have gotten many times before and the best I could do was to delete my id column and recreate. Sometimes that worked. Other times I just gave up.

This is how I have the query set up:

Any help you could provide would be greatly appreciated. Every time I see this error message I want to throw my computer out the window. If you need additional information, please let me know. Thank you.

By the way, if I don't set a primary key, then it works.

Can you provide an example of what form1.data looks like? Are you passing a value for foam_tracking?

1 Like

At a high level, this error indicates that the new record you've trying to insert into your database is not being assigned a unique primary key.

Can you share the configuration of your primary key column?

And to add on to @jg80's question, are you passing in a value for the primary key as part of form1.data?

I think this is all of the information you are requesting.