Matheus Alcantara <matheusssilv97@gmail.com> writes:
> Attached rebased v3 due to f80bedd52b1. No additional changes compared
> to v2.
I looked at this and frankly I think it's going in the wrong
direction. I agree that showing "virtual" is unhelpful, but
I don't like this approach for a couple of reasons:
1. Inserting a column expression could easily make the error
message annoyingly long.
2. Adding this much complexity in an error code path doesn't
seem like a good idea. Such paths are typically not well
tested, and if there is any bug lurking, it will result in
an error message quite removed from the user's problem.
3. It's making virtual generated columns behave (even more)
differently from stored generated columns. I think the
general plan has been to make them act as alike as possible.
So what would comport better with the behavior of stored columns
is to show the expression's value. I agree with you that
calculating that in the error path is a no-go, but haven't we
computed it earlier? Or could we do so, if there are constraints
to be checked?
regards, tom lane