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" <serg@vostok.net>)
Ответы Re: BUG #2954: null is not checked against domain constraints in return clause  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
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"
Дата:
Сообщение: BUG #2954: null is not checked against domain constraints in return clause
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2948: default null values for not-null domains