public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: jian he <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Dean Rasheed <[email protected]>
Subject: Re: Virtual generated columns
Date: Wed, 08 Jan 2025 11:38:58 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<CAEZATCV=RX0M58-uqSR6tFjwQAFnEcx3hvW-9ZZfRQJLg5LzRw@mail.gmail.com>
	<[email protected]>
	<CAEZATCU3q=znAL7X1aSxuMpjfSyB1cT5j398HPb9ix9ci_HUqA@mail.gmail.com>
	<[email protected]>
	<CAEZATCVLfMzNwT1J0bnvtv6YbmNSN9QSXb+1QSGyX6vK4q67Ow@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CACJufxF8fmM=Dbm4pDFuV_nKGz2-No0k4YifhrF3-rjXTWJM3w@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<CACJufxEeUfpUoFng=0Pm0-cJ4rwyBJCv4x_FXmkYqozWB7uvFQ@mail.gmail.com>
	<999d5c67-94f7-4ee8-82ec-09e1fd4bb689@! eisentraut.org>

Peter Eisentraut <[email protected]> writes:
> On 03.12.24 15:15, jian he wrote:
>> SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE
>> attgenerated IN ('v') and (attnotnull or not atthasdef);

> I don't understand what the purpose of testing attnotnull is.  That is 
> independent of attgenerated, I think.

Does it make any sense to set NOT NULL on a generated column (virtual
or otherwise, but especially virtual)?  What is the system supposed
to do if the expression evaluates to null?  That concern generalizes
to any constraint really.  Even if we checked it at row storage time,
there's no real guarantee that the expression is immutable enough
to pass the constraint later.

			regards, tom lane






view thread (75+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Virtual generated columns
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox