Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint for non-immutable generated columns #58

Open
darora opened this issue Apr 19, 2024 · 1 comment
Open

Lint for non-immutable generated columns #58

darora opened this issue Apr 19, 2024 · 1 comment

Comments

@darora
Copy link

darora commented Apr 19, 2024

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.

@olirice
Copy link
Collaborator

olirice commented May 10, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants