splinter icon indicating copy to clipboard operation
splinter copied to clipboard

Lint for non-immutable generated columns

Open darora opened this issue 1 year ago • 1 comments

Generated columns in Postgres are required to only use immutable functions, but this does not seem to be enforced at creation time. It can, however, cause the upgrade process to fail.

darora avatar Apr 19 '24 00:04 darora

this does not seem to be enforced at creation time

I tried

create table abc (
  id int primary key,
  x timestamp generated always as ( now() ) stored
);

on 15.1 and 16.2 and got a

ERROR:  42P17: generation expression is not immutable

in both cases

@darora do you have a reproducible way to get into the bad state that I can use for testing?

relevant (internal) slack thread

olirice avatar May 10 '24 14:05 olirice

bump @darora

olirice avatar Jul 10 '24 17:07 olirice

I do not, unfortunately. Let's close this unless we run into the issue again. We've only seen it the one time.

darora avatar Aug 04 '24 23:08 darora