Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

MySQL Auto-Increment Primary Key Incompatibility

I am trying to use the patch function to add a record to a MySQL table, however I am getting an error saying that my primary key field is required. This seems incorrect as the field is meant to be autofilled on the MySQL side. I know this can be "fixed" by letting powerapps take care of the auto increment functionality, however I found this solution to be quite prone to errors. Is there a way to do this properly and let MySQL take care of it when adding a new record?


For reference my primary key column is set up like this:


Community Support
Community Support

Hi @Dorian1 ,

The reason why you met this problem is that since this field is primary key, you need to update with this field's value.

However, you set it  auto-Increment, it means that its data will be generated automatically by system. So you can not update manually.

So this is very contradictory.

I suggest you not set this field as primary key, set another field as primary key.

Then when you update data, you do not need to update this ID field's value.



Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft - Just to clarify, the issue here is that there's a bug that prevents us from creating records against primary key fields with auto_increment set to true. This issue effects PostgreSQL, as well as MySQL. Microsoft SQL Server works correctly - we can define a table with an auto-incrementing primary key field (ie an identity column), and PowerApps can add records to that table without any problems.

@Dorian1 - As far as I know, the only solution is to use the fixes that you've probably seen already - eg, generate your own id values by finding the maximum value and adding 1. I get that this is a very poor solution and hopefully, Microsoft will fix this at some point. Hopefully, perhaps someone else here might know of a different workaround...

Frequent Visitor

Thanks for the reply @v-yutliu-msft and @timl


As far as I'm aware having an auto incrementing primary key column is a fairly standard way of setting up a table, so I'm struggling to see how this is contradictory. Especially seeing as when creating a record in MySQL locally, the primary key field being blank is not a problem, it's only a restriction when using powerapps. Moreover as timl mentioned this problem only affects some SQL distributions but not others, making me think that this is simply a bug.


As a result it seems like I basically have to get rid of either the primary key attribute or the auto increment attribute in order for this to work, in my case I feel like primary key is actually less important since the database is fairly small and tables aren't referenced to each other, however I feel like this is a fairly significant problem and a great disappointment, especially considering that you need a paid subscription to use MySQL as a data source when it's supported so poorly.

Frequent Visitor

Ah, another issue I ran into, seems tables without a primary key are considered read-only, leaving me with no choice but to do the auto-incrementing in powerapps, not ideal. 😕

Hi @Dorian1 

Yes, I agree that this is a standard way of setting up a table and I'm sure this is a bug.

I was just writing a comment about tables being read-only without a primary key, but you beat me to it!


Advocate II
Advocate II

We've had this issue for over a year now and have had to inform users that the error message is 'just something that happens'. It's really not ideal to have the error displayed however it still adds the row successfully in MySQL.


Maybe they'll look at this at some point 🤞



@ChrisHH I am struggling with the same problem, the error is displayed & the row is not inserted into MySql !! 

New Member

Why isn't there anything happening?

This is obviously a bug in the PostreSQL and MySQL connector. It is absolutely not a professional solution if you have to take care of the auto-increment of the PrimaryKey in PowerAutomate or in PowerApps, because this is prone to errors. Precisely when several applications are simultaneously inserting data into the same table.
Best regards


Super User
Super User

Hi @maxslo 

I suspect that nothing is happening here because this is not a high priority issue for Microsoft. Their focus will be on Dataverse and other features that are more Microsoft centric.


I agree that this is a bug that should be fixed. Therefore, I have added a post in the ideas forum here.


I would recommend that anyone who wants this bug to be fixed, vote for this idea. The number of voters will hopefully enable Microsoft to better prioritise this issue.

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.


New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,429)