Re: Non-Stored Generated Columns

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dominique Devienne <ddevienne(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Non-Stored Generated Columns
Date: 2024-02-28 22:39:33
Message-ID: CANzqJaARwTp-tFPRp5HYpUZE4+OWuyLDabaq5kJXqGCQJmqRHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 28, 2024 at 2:11 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Dominique Devienne <ddevienne(at)gmail(dot)com> writes:
> > Views can have foreign-keys?
>
> Surely you'd put the FK on the underlying table.
>
> > Generated view columns be indexed?
>
> You want an index on a virtual column? Sure, just build an expression
> index (on the underlying table) that matches it.
>
> I agree with Laurenz that it's hard to see much use-case here
> that's not sufficiently covered already.
>

Oracle and SQLite have them, so, by definition, *many* more than one person
(you don't get a feature added to Oracle that easily...) has seen
sufficient reasons for doing it instead of modifying the underlying table,
or building an expression index.

My guess as to why they do it is "clarity of design".

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Erik Wienhold 2024-02-29 00:12:44 Re: Excel Source [24]] Error: System.Exception: SqlTruncateException: Numeric arithmetic causes
Previous Message Daniel Gustafsson 2024-02-28 21:08:56 Re: Documentation diff