Re: BUG #2954: null is not checked against domain constraints in return clause
От
Sergiy Vyshnevetskiy
Тема
Re: BUG #2954: null is not checked against domain constraints
in return clause
Дата
Msg-id
Pine.LNX.4.64.0702011910000.22446@uanet.vostok.net
Ответ на
BUG #2954: null is not checked against domain constraints in return clause (Sergiy Vyshnevetskiy)
Список
Дерево обсуждения
BUG #2954: null is not checked against domain constraints in return clause "Sergiy Vyshnevetskiy" <serg@vostok.net>
Re: BUG #2954: null is not checked against domain constraints
in return clause Sergiy Vyshnevetskiy <serg@vostok.net>
Re: BUG #2954: null is not checked against domain constraints in return clause Tom Lane <tgl@sss.pgh.pa.us>
I believe the bug to be here:
/* Normal case for scalar results */
estate->retval = exec_eval_expr(estate, stmt->expr,
&(estate->retisnull),
&(estate->rettype));
in exec_stmt_return() in pl_exec.c.
As I understand it, exec_eval_expr overwrites(!) estate->rettype instead
of casting the result to it.
What should be done is something like:
Datum value;
Oid valtype;
value = exec_eval_expr(estate, stmt->expr, &(estate->retisnull),
&valtype);
estate->retval = exec_cast_value(value, valtype, estate->rettype,
reqinput,
reqioparam,
reqtypmod,
estate->retisnull);
but where to get reqinput, reqioparam and reqtypmod? They should be
accessed through estate pointer, I think.В списке pgsql-bugs по дате отправления
От: Sergiy Vyshnevetskiy
Дата: