Re: [PATCH] no table rewrite when set column type to constrained domain

From: Viktor Holmberg <v(at)viktorh(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>
Subject: Re: [PATCH] no table rewrite when set column type to constrained domain
Date: 2026-03-14 16:32:07
Message-ID: e5044253-bb1d-4829-bf54-42fdab8dbd3a@Spark
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

As I’m sure you know Jian this needs a rebase now that a0b6ef29a518 has been merged. It’s a bit hard for me to review in this state when I can’t apply the patches cleanly.

+ /*
+ * we can not use ExecEvalExprNoReturn here, because we
+ * use ExecInitExpr compile NewColumnValue->expr. Here,
+ * we only check whether the oldslot value satisfies the
+ * domain constraint. So it is ok to override the value
+ * evaluated by ExecEvalExpr.
+ */
+ values = ExecEvalExpr(ex->exprstate, econtext, &isnull);
+ values = (Datum) 0;
+ isnull = true;

I don’t understand this piece of code, and why value is re-assigned right away. Not saying it’s wrong but if you could explain why it is like that to someone not well versed in C. Would something like (void) ExecEvalExpr(ex->exprstate, econtext, &isnull); do?

There are other things I don’t quite understand so will give it another pass once it’s been rebased.

/Viktor

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Rustam ALLAKOV 2026-03-14 16:54:00 Re: virtual generated column as partition key
Previous Message Zsolt Parragi 2026-03-14 15:06:04 Re: pg_plan_advice