Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION

Поиск
Список
Период
Сортировка
Искать

Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION

От:
Zsolt Parragi <zsolt.parragi@percona.com>
Дата:
Looks good, I have one nitpick question:

+			if (isnull)
+				elog(WARNING, "null conbin for relation \"%s\"",
+					 RelationGetRelationName(rel));

Shouldn't this be an error instead? Most existing checks treat it as
an error, and that seems better to me as this shouldn't happen
normally?


Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION

От:
jian he <jian.universality@gmail.com>
Дата:
Вложения:
On Fri, May 29, 2026 at 6:58 AM Zsolt Parragi  wrote:
>
> Looks good, I have one nitpick question:
>
> +                       if (isnull)
> +                               elog(WARNING, "null conbin for relation \"%s\"",
> +                                        RelationGetRelationName(rel));
>
> Shouldn't this be an error instead? Most existing checks treat it as
> an error, and that seems better to me as this shouldn't happen
> normally?
>
OK.

I changed it to:
> +                       if (isnull)
> +                               elog(ERROR, "null conbin for relation \"%s\"",
> +                                        RelationGetRelationName(rel));

I also slightly rephrased the commit message.



--
jian
https://www.enterprisedb.com/

Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION

От:
Chao Li <li.evan.chao@gmail.com>
Дата:


> On Jun 2, 2026, at 08:41, jian he  wrote:
> 
> On Fri, May 29, 2026 at 6:58 AM Zsolt Parragi  wrote:
>> 
>> Looks good, I have one nitpick question:
>> 
>> +                       if (isnull)
>> +                               elog(WARNING, "null conbin for relation \"%s\"",
>> +                                        RelationGetRelationName(rel));
>> 
>> Shouldn't this be an error instead? Most existing checks treat it as
>> an error, and that seems better to me as this shouldn't happen
>> normally?
>> 
> OK.
> 
> I changed it to:
>> +                       if (isnull)
>> +                               elog(ERROR, "null conbin for relation \"%s\"",
>> +                                        RelationGetRelationName(rel));
> 
> I also slightly rephrased the commit message.
> 
> 
> 
> --
> jian
> https://www.enterprisedb.com/

Sorry for not noticing this thread earlier. I also found the same problem while testing the feature and posted a patch in [1]. Thanks to Jian for pointing out this thread.

After reading v6 from this thread, I think my implementation is slightly different:

* v6 adds a new helper, RememberWholeRowDependentForRebuilding(), which reads pg_constraint and pg_index to find objects to rebuild.
* My implementation in [1] reuses RememberAllDependentForRebuilding(), which reads pg_depend, because whole-row dependencies have refobjsubid = 0. My v1 missed the partial-index case, so I added a new helper in v2 to read pg_index.

The main difference is that my patch reuses the existing dependency-based rebuild machinery where possible, and only scans pg_index directly for the partial-index case where pg_depend does not record the whole-row Var dependency. It is also smaller: this thread’s v6 adds 185 lines to tablecmds.c, while my v2 adds 123 lines.

Would you mind taking a look at my implementation in [1]?

BTW, I have also added this problem to the open items list, as I think it should be fixed before releasing v19.

[1] https://www.postgresql.org/message-id/71242FEA-15A3-4073-9FA1-561CA744ACBD%40gmail.com

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION

От:
Peter Eisentraut <peter@eisentraut.org>
Дата:
On 02.06.26 02:41, jian he wrote:
> On Fri, May 29, 2026 at 6:58 AM Zsolt Parragi  wrote:
>>
>> Looks good, I have one nitpick question:
>>
>> +                       if (isnull)
>> +                               elog(WARNING, "null conbin for relation \"%s\"",
>> +                                        RelationGetRelationName(rel));
>>
>> Shouldn't this be an error instead? Most existing checks treat it as
>> an error, and that seems better to me as this shouldn't happen
>> normally?
>>
> OK.
> 
> I changed it to:
>> +                       if (isnull)
>> +                               elog(ERROR, "null conbin for relation \"%s\"",
>> +                                        RelationGetRelationName(rel));
> 
> I also slightly rephrased the commit message.

Committed with some code beautification editorialization.



Re: [PATCH] Rebuild CHECK constraints after generated column SET EXPRESSION

От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
[RMT hat]

On Wed, Jul 08, 2026 at 08:15:54PM +0200, Peter Eisentraut wrote:
> Committed with some code beautification editorialization.

This is listed on the v19 open items wiki [0] as an "older bug affecting
stable branches."  Is there more work to do, or can this be moved to the
"fixed issues" section?

[0] https://wiki.postgresql.org/wiki/PostgreSQL_19_Open_Items

-- 
nathan


FAQ