public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: jian he <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Dean Rasheed <[email protected]>
Subject: Re: Virtual generated columns
Date: Tue, 12 Nov 2024 17:09:35 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CACJufxH77uYui9tawWmn9uG=3B96+JwyYrGrrr9SSzdVTCYFwg@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<CACJufxGh=XX7q5xTci---HikSJsOwP7_qCNyyDHdp2YL4NLZCg@mail.gmail.com>
	<CACJufxHxoz_KVQxcQ=cSvJc+PNbh=FaHbcMZCOisoOaGAgjy4w@mail.gmail.com>
	<[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>
	<CACJufxH77uYui9tawWmn9uG=3B96+JwyYrGrrr9SSzdVTCYFwg@mail.gmail.com>

On 12.11.24 09:49, jian he wrote:
>> On Wed, Nov 6, 2024 at 12:17 AM Peter Eisentraut <[email protected]> wrote:
> RelationBuildPartitionKey
> if (!isnull)
> {
>          char       *exprString;
>          Node       *expr;
>          exprString = TextDatumGetCString(datum);
>          expr = stringToNode(exprString);
>          pfree(exprString);
>          expr = expand_generated_columns_in_expr(expr, relation);
> }
> no need expand_generated_columns_in_expr?
> in ComputePartitionAttrs, we already forbidden generated columns to be
> part of the partition key.

True.  I have removed this extra code in v9.

> check_modified_virtual_generated, we can replace fastgetattr to
> heap_attisnull? like:
>              // bool        isnull;
>              // fastgetattr(tuple, i + 1, tupdesc, &isnull);
>              // if (!isnull)
>              //     ereport(ERROR,
>              //             (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
>              //              errmsg("trigger modified virtual generated
> column value")));
>              if (!heap_attisnull(tuple, i+1, tupdesc))
>                  ereport(ERROR,
>                          (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
>                           errmsg("trigger modified virtual generated
> column value")));

I don't know.  fastgetattr() is supposed to be "fast". ;-)  It's all 
inline functions, so maybe that is actually correct.  I don't have a 
strong opinion either way.







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]
  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