Is it possible to use a subquery expression in a generated column? [closed]
Asked Answered
P

1

6

I am using PostgreSQL 12, is it possible to use a query on a generated column?

I mean, using in the column creation

GENERATED ALWAYS AS (some query) STORED
Porbeagle answered 29/1, 2021 at 14:26 Comment(1)
Voted to reopen. This question is clear enough that who doesn’t find it focused on one problem only really should work on their reading comprehension.Ridgeway
M
3

The "some query" has to be immutable, at least in version 13:

The generation expression can refer to other columns in the table, but not other generated columns. Any functions and operators used must be immutable. References to other tables are not allowed.

Moskva answered 29/1, 2021 at 14:52 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.