Re: [PATCH] no table rewrite when set column type to constrained domain
| От | Viktor Holmberg |
|---|---|
| Тема | Re: [PATCH] no table rewrite when set column type to constrained domain |
| Дата | |
| Msg-id | e5044253-bb1d-4829-bf54-42fdab8dbd3a@Spark обсуждение исходный текст |
| Ответ на | Re: [PATCH] no table rewrite when set column type to constrained domain (jian he <jian.universality@gmail.com>) |
| Ответы |
Re: [PATCH] no table rewrite when set column type to constrained domain
|
| Список | 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.
+ /*
+ * 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
В списке pgsql-hackers по дате отправления: