Table changeset doesn't include row id

I'm using the changesetArray from the table component in a function that handles updating the rows in my DB. Up until recently, each of the changes in the changesetArray used to include the id of the changed row, but for some reason, it's not there anymore?

Was this an internal change at Retool, or was the id never supposed to be available in the changesetArray anyways?

Hey @Janosch_Herrmann,

I hope note, that would mess up 80% of my apps!

Have you checked if your table's primary key hasn't been accidentaly removed in yoru column settings?

Tbh, that was the first thing I checked, and it was there, but now it was indeed removed again. Is it possible that this resets automatically sometimes, possibly when there are two rows in the data with the same id?

Because I was having this issue a couple of times now.

Sometimes if your query returns new columns, it may remove it. But I'm not sure to be honest.

1 Like

Maybe someone from Retool knows this?

1 Like

Do you have a primary key set? If so, the id should be included :thinking:

CleanShot 2024-11-20 at 11.09.06@2x

You can also retrieve all values in the row using Interaction->Advanced settings->Include full rows in changeset array:

Yeah, the problem was that this was somehow being changed automatically from time to time.

Thanks - just to confirm, the primary key setting was being cleared automatically? Has it happened recently?

In case it's helpful, I noticed we have a bug where the primary key gets cleared when you regenerate columns

I just had this issue. The primary key reset itself to null after adding a column to two different tables. Fixing the primary key fixed the issue here, but you definitely still have a bug where the primary key is reset every single time a row is added to the table. I've noticed this a bunch of different times over the past ~6mo - I've learned to look for it, but it still bites me in the ass occasionally.

Thanks for these details! I'll try to reproduce this and inform our team :pray:

[Edit]: I have only been able to reproduce this issue when a new column gets added to the data in the data source or when a builder clicks "regenerate columns". This issue could come up if a new record is added to the data source and that new record includes a property that isn't in the table yet. I don't have a timeline for fixing this yet, but I'll reach out here when it gets fixed