I have a table with a generated column (PostgreSQL: Documentation: 16: 5.3. Generated Columns).
So far I only used it inside queries using a fragment, which was sufficient since I never needed to read the value from a loaded schema, so I simply ommitted the field
declaration for it.
Now that I want to load the value, I run into the problem that even when I only change a different field on an existing record, Ecto seems to generate an update for the value in the column, which Postgres correcly rejects with an error. What I would need is kind of the opposite of the load_in_query
flag, to prevent that and treat the column as immutable (which would introduce the problem that I’d get back a stale value after an update, but that’s not my concern right now).
I searched but couldn’t find anything related, and it looks like I need to work around the problem for the time being.
Does anyone else have experience with exposing a generated column on an Ecto Schema?