Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24a814f

Browse files
committed
plpgsql's exec_simple_cast_value() mistakenly supposed that it could bypass
casting effort whenever the input value was NULL. However this preventsapplication of not-null domain constraints in the cases that use thisfunction, as illustrated in bug #4741. Since this function isn't meantfor use in performance-critical paths anyway, this certainly seems likeanother case of "premature optimization is the root of all evil".Back-patch as far as 8.2; older versions made no effort to enforcedomain constraints here anyway.
1 parentbfd17f9 commit24a814f

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.236 2009/03/26 22:26:08 petere Exp $
11+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.237 2009/04/02 01:16:11 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -4754,26 +4754,23 @@ exec_simple_cast_value(Datum value, Oid valtype,
47544754
Oidreqtype,int32reqtypmod,
47554755
boolisnull)
47564756
{
4757-
if (!isnull)
4757+
if (valtype!=reqtype||reqtypmod!=-1)
47584758
{
4759-
if (valtype!=reqtype||reqtypmod!=-1)
4760-
{
4761-
Oidtypinput;
4762-
Oidtypioparam;
4763-
FmgrInfofinfo_input;
4759+
Oidtypinput;
4760+
Oidtypioparam;
4761+
FmgrInfofinfo_input;
47644762

4765-
getTypeInputInfo(reqtype,&typinput,&typioparam);
4763+
getTypeInputInfo(reqtype,&typinput,&typioparam);
47664764

4767-
fmgr_info(typinput,&finfo_input);
4765+
fmgr_info(typinput,&finfo_input);
47684766

4769-
value=exec_cast_value(value,
4770-
valtype,
4771-
reqtype,
4772-
&finfo_input,
4773-
typioparam,
4774-
reqtypmod,
4775-
isnull);
4776-
}
4767+
value=exec_cast_value(value,
4768+
valtype,
4769+
reqtype,
4770+
&finfo_input,
4771+
typioparam,
4772+
reqtypmod,
4773+
isnull);
47774774
}
47784775

47794776
returnvalue;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp