Postgres generated column cast Varchar to Date
I’am trying to use a generated column to cast a Varchar column to a Date column. The expression to generate the date consists of some string manipulation to derive an appropriate string that can then be casted to DATE.
This is apparently not possible though, because – as the Postgres documentation about generated fields states – only immutable functions can be used in the expression to generate the column.
If using a generated column in postgres with an expression containing a function such a CAST or TO_DATE you’ll thus get the error :
generation expression is not immutable
Postgres generated column cast Varchar to Date
I’am trying to use a generated column to cast a Varchar column to a Date column. The expression to generate the date consists of some string manipulation to derive an appropriate string that can then be casted to DATE.
This is apparently not possible though, because – as the Postgres documentation about generated fields states – only immutable functions can be used in the expression to generate the column.
If using a generated column in postgres with an expression containing a function such a CAST or TO_DATE you’ll thus get the error :
generation expression is not immutable