Re: [HACKERS] generated columns

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] generated columns
Дата
Msg-id a9dcee31-6ae9-f581-f362-a27774cbe156@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] generated columns  (Michael Paquier <michael@paquier.xyz>)
Ответы Re: [HACKERS] generated columns  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On 2019-02-26 06:30, Michael Paquier wrote:
> +   if (attgenerated)
> +   {
> +       /*
> +        * Generated column: Dropping anything that the generation expression
> +        * refers to automatically drops the generated column.
> +        */
> +       recordDependencyOnSingleRelExpr(&colobject, expr, RelationGetRelid(rel),
> +                                       DEPENDENCY_AUTO,
> +                                       DEPENDENCY_AUTO, false);
> +   }
> A CCI is not necessary I think here, still the recent thread about
> automatic dependencies with identity columns had a much similar
> pattern...

Yeah, worth taking another look.

> 
> +           else if (generated[0] == ATTRIBUTE_GENERATED_VIRTUAL)
> +               default_str = psprintf("generated always as (%s)", PQgetvalue(res, i, attrdef_col));
> Nit: I would add VIRTUAL instead of relying on the default option.

I suppose we'll decide that when the virtual columns are actually added.
 I see your point.

> Another thing I was thinking about: could it be possible to add a
> sanity check in sanity_check.sql so as a column more that one
> field in attidentity, attgenerated and atthasdef set at the same time?

There is something like that at the top of
src/test/regress/sql/generated.sql.  I can expand that.  But it only
covers the tests.  For run time checks, you'd want something like
pg_catcheck.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: Offline enabling/disabling of data checksums
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] generated columns