Re: Behavior of GENERATED columns per SQL2003 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Behavior of GENERATED columns per SQL2003
Date
Msg-id 9988.1178850690@sss.pgh.pa.us
Whole thread Raw
In response to Re: Behavior of GENERATED columns per SQL2003  ("Simon Riggs" <simon@2ndquadrant.com>)
Responses Re: Behavior of GENERATED columns per SQL2003  (Richard Huxton <dev@archonet.com>)
List pgsql-hackers
"Simon Riggs" <simon@2ndquadrant.com> writes:
> On Thu, 2007-05-10 at 10:11 -0400, Tom Lane wrote:
>> As for GENERATED ALWAYS AS (expr), now that we understand that it's not
>> supposed to define a virtual column, what's the point?

> We do need virtual columns, whether the spec requires them or not.

Agreed, they seem more useful than what the spec's got in mind.  You can
fake a virtual column using a view, but it's a whole lot more painful
than faking a GENERATED column using a trigger (at least if you wish the
view to be updatable).

> ISTM that we should interpret this as a requirement for a virtual
> column. We can always move from that to a stored column if the spec
> becomes more specific, though it would be harder to move the other way.

If you're suggesting commandeering the spec's GENERATED ALWAYS syntax
to represent virtual columns, when the committee has made it clear that
that's not what they intend, I say that's sheer folly.  What will you do
when they tweak the spec to the point where a virtual column clearly
doesn't satisfy it?  If we want a nonstandard feature we should use a
nonstandard syntax for it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: Feature lists for 8.3 and 8.4
Next
From: Richard Huxton
Date:
Subject: Re: Behavior of GENERATED columns per SQL2003